annotate gtk/gtkconv.c @ 14885:51c51d89c114

[gaim-migrate @ 17654] This seems good. Change prefs dialog around a bit to add docklet pref. beta5 time? committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 02 Nov 2006 21:09:12 +0000
parents 0e4833acd31c
children ee29923d5159
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2 * @file gtkconv.c GTK+ Conversation API
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3 * @ingroup gtkui
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5 * gaim
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
9 * source distribution.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
10 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
15 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
20 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
24 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
25 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
26 #include "internal.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
27 #include "gtkgaim.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
28
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
29 #ifndef _WIN32
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
30 # include <X11/Xlib.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
31 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
32
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
33 #ifdef USE_GTKSPELL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
34 # include <gtkspell/gtkspell.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
35 # ifdef _WIN32
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
36 # include "wspell.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
37 # endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
38 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
39
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
40 #include <gdk/gdkkeysyms.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
41
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
42 #include "account.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
43 #include "cmds.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
44 #include "debug.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
45 #include "idle.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
46 #include "imgstore.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
47 #include "log.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
48 #include "notify.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
49 #include "prpl.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
50 #include "request.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
51 #include "util.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
52
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
53 #include "gtkdnd-hints.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
54 #include "gtkblist.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
55 #include "gtkconv.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
56 #include "gtkconvwin.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
57 #include "gtkdialogs.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
58 #include "gtkimhtml.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
59 #include "gtkimhtmltoolbar.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
60 #include "gtklog.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
61 #include "gtkmenutray.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
62 #include "gtkpounce.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
63 #include "gtkprefs.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
64 #include "gtkprivacy.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
65 #include "gtkthemes.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
66 #include "gtkutils.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
67 #include "gaimstock.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
68
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
69 #include "gtknickcolors.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
70
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
71 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
72
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
73 typedef enum
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
74 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
75 GAIM_GTKCONV_SET_TITLE = 1 << 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
76 GAIM_GTKCONV_BUDDY_ICON = 1 << 1,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
77 GAIM_GTKCONV_MENU = 1 << 2,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
78 GAIM_GTKCONV_TAB_ICON = 1 << 3,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
79 GAIM_GTKCONV_TOPIC = 1 << 4,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
80 GAIM_GTKCONV_SMILEY_THEME = 1 << 5,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
81 GAIM_GTKCONV_COLORIZE_TITLE = 1 << 6
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
82 }GaimGtkConvFields;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
83
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
84 #define GAIM_GTKCONV_ALL ((1 << 7) - 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
85
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
86 #define SEND_COLOR "#204a87"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
87 #define RECV_COLOR "#cc0000"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
88 #define HIGHLIGHT_COLOR "#AF7F00"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
89
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
90 /* Undef this to turn off "custom-smiley" debug messages */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
91 #define DEBUG_CUSTOM_SMILEY
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
92
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
93 #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
94
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
95 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
96 /* These colors come from the default GNOME palette */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
97 static GdkColor nick_colors[] = {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
98 {0, 47616, 46336, 43776}, /* Basic 3D Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
99 {0, 32768, 32000, 29696}, /* Basic 3D Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
100 {0, 22016, 20992, 18432}, /* 3D Shadow */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
101 {0, 33536, 42496, 32512}, /* Green Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
102 {0, 23808, 29952, 21760}, /* Green Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
103 {0, 17408, 22016, 12800}, /* Green Shadow */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
104 {0, 57344, 46592, 44800}, /* Red Hilight */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
105 {0, 49408, 26112, 23040}, /* Red Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
106 {0, 34816, 17920, 12544}, /* Red Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
107 {0, 49408, 14336, 8704}, /* Red Shadow */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
108 {0, 34816, 32512, 41728}, /* Purple Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
109 {0, 25088, 23296, 33024}, /* Purple Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
110 {0, 18688, 16384, 26112}, /* Purple Shadow */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
111 {0, 40192, 47104, 53760}, /* Blue Hilight */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
112 {0, 29952, 36864, 44544}, /* Blue Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
113 {0, 57344, 49920, 40448}, /* Face Skin Medium */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
114 {0, 45824, 37120, 26880}, /* Face skin Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
115 {0, 33280, 26112, 18176}, /* Face Skin Shadow */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
116 {0, 57088, 16896, 7680}, /* Accent Red */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
117 {0, 39168, 0, 0}, /* Accent Red Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
118 {0, 17920, 40960, 17920}, /* Accent Green */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
119 {0, 9728, 50944, 9728} /* Accent Green Dark */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
120 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
121
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
122 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(*nick_colors))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
123 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
124
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
125 /* From http://www.w3.org/TR/AERT#color-contrast */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
126 #define MIN_BRIGHTNESS_CONTRAST 75
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
127 #define MIN_COLOR_CONTRAST 200
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
128
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
129 #define NUM_NICK_COLORS 220
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
130 static GdkColor *nick_colors = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
131 static guint nbr_nick_colors;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
132
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
133 typedef struct {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
134 GtkWidget *window;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
135
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
136 GtkWidget *entry;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
137 GtkWidget *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
138
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
139 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
140
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
141 } InviteBuddyInfo;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
142
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
143 static GtkWidget *invite_dialog = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
144 static GtkWidget *warn_close_dialog = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
145
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
146 static GaimGtkWindow *hidden_convwin = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
147 static GList *window_list = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
148
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
149
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
150 static gboolean update_send_to_selection(GaimGtkWindow *win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
151 static void generate_send_to_items(GaimGtkWindow *win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
152
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
153 /* Prototypes. <-- because Paco-Paco hates this comment. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
154 static void got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
155 static void gray_stuff_out(GaimGtkConversation *gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
156 static GList *generate_invite_user_names(GaimConnection *gc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
157 static void add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
158 static gboolean tab_complete(GaimConversation *conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
159 static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
160 static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
161 static void update_typing_icon(GaimGtkConversation *gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
162 static const char *item_factory_translate_func (const char *path, gpointer func_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
163 gboolean gaim_gtkconv_has_focus(GaimConversation *conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
164 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
165 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
166 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
167 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
168 static void gaim_gtkconv_update_fields(GaimConversation *conv, GaimGtkConvFields fields);
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
169 static void focus_out_from_menubar(GtkWidget *wid, GaimGtkWindow *win);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
170
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
171 static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
172 static GdkColor col;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
173 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
174 float scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
175
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
176 col = nick_colors[g_str_hash(name) % nbr_nick_colors];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
177 scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
178 (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
179
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
180 /* The colors are chosen to look fine on white; we should never have to darken */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
181 if (scale > 1) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
182 col.red *= scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
183 col.green *= scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
184 col.blue *= scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
185 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
187 return &col;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
188 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
189
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
190 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
191 * Callbacks
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
192 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
193
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
194 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
195 close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
196 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
197 GList *list = g_list_copy(gtkconv->convs);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
198
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
199 g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
200 g_list_free(list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
201
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
202 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
203 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
205 static gboolean
14701
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
206 lbox_size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, gpointer data)
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
207 {
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
208 gaim_prefs_set_int("/gaim/gtk/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width);
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
209
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
210 return FALSE;
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
211 }
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
212
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
213 static gboolean
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
214 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
215 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
216 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
217
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
218 if (!GTK_WIDGET_VISIBLE(w))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
219 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
220
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
221 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
222 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
223
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
224 if (gtkconv->auto_resize) {
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
225 return FALSE;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
226 }
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
227
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
228 /* I find that I resize the window when it has a bunch of conversations in it, mostly so that the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
229 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
230 * if there is only one conversation in the window. This way we'll be setting new windows to the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
231 * size of the last resized new window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
232 /* I think that the above justification is not the majority, and that the new tab resizing should
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
233 * negate it anyway. --luke */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
234 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
235 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
236 if (w == gtkconv->imhtml) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
237 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
238 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
239 }
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
240 if (w == gtkconv->lower_hbox)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
241 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
242 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
243 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
244 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
245 if (w == gtkconv->imhtml) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
246 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
247 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
248 }
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
249 if (w == gtkconv->lower_hbox)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
250 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
251 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
252
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
253 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
254 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
255
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
256 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
257 default_formatize(GaimGtkConversation *c)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
258 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
259 GaimConversation *conv = c->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
260
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
261 if (conv->features & GAIM_CONNECTION_HTML)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
262 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
263 char *color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
264 GdkColor fg_color, bg_color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
265
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
266 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold") != GTK_IMHTML(c->entry)->edit.bold)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
267 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
268
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
269 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic") != GTK_IMHTML(c->entry)->edit.italic)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
270 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
271
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
272 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline") != GTK_IMHTML(c->entry)->edit.underline)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
273 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
274
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
275 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
276 gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
277
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
278 if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE))
14864
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
279 {
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
280 int size = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
281
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
282 /* 3 is the default. */
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
283 if (size != 3)
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
284 {
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
285 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), size);
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
286 }
b8a4f82bc24e [gaim-migrate @ 17633]
Richard Laager <rlaager@wiktel.com>
parents: 14853
diff changeset
287 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
288
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
289 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
290 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
291 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
292 &fg_color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
293 color = g_strdup_printf("#%02x%02x%02x",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
294 fg_color.red / 256,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
295 fg_color.green / 256,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
296 fg_color.blue / 256);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
297 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
298 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
299 color = g_strdup("");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
300
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
301 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
302 g_free(color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
303
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
304 if(!(conv->features & GAIM_CONNECTION_NO_BGCOLOR) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
305 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
306 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
307 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
308 &bg_color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
309 color = g_strdup_printf("#%02x%02x%02x",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
310 bg_color.red / 256,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
311 bg_color.green / 256,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
312 bg_color.blue / 256);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
313 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
314 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
315 color = g_strdup("");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
316
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
317 gtk_imhtml_toggle_background(GTK_IMHTML(c->entry), color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
318 g_free(color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
319
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
320
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
321 if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
322 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
323 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
324 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
325 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
326 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
327
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
328 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
329 clear_formatting_cb(GtkIMHtml *imhtml, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
330 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
331 default_formatize(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
332 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
333
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
334 static const char *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
335 gaim_gtk_get_cmd_prefix(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
336 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
337 return "/";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
338 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
339
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
340 static GaimCmdRet
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
341 say_command_cb(GaimConversation *conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
342 const char *cmd, char **args, char **error, void *data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
343 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
344 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
345 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
346 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
347 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
348
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
349 return GAIM_CMD_RET_OK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
350 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
352 static GaimCmdRet
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
353 me_command_cb(GaimConversation *conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
354 const char *cmd, char **args, char **error, void *data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
355 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
356 char *tmp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
357
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
358 tmp = g_strdup_printf("/me %s", args[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
359
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
360 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
361 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
362 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
363 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
364
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
365 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
366 return GAIM_CMD_RET_OK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
367 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
368
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
369 static GaimCmdRet
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
370 debug_command_cb(GaimConversation *conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
371 const char *cmd, char **args, char **error, void *data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
372 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
373 char *tmp, *markup;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
374 GaimCmdStatus status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
375
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
376 if (!g_ascii_strcasecmp(args[0], "version")) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
377 tmp = g_strdup_printf("me is using Gaim v%s.", VERSION);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
378 markup = g_markup_escape_text(tmp, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
379
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
380 status = gaim_cmd_do_command(conv, tmp, markup, error);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
381
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
382 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
383 g_free(markup);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
384 return status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
385 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
386 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
387 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
388 return GAIM_CMD_STATUS_OK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
389 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
390 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
391
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
392 static GaimCmdRet
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
393 clear_command_cb(GaimConversation *conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
394 const char *cmd, char **args, char **error, void *data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
395 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
396 GaimGtkConversation *gtkconv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
397
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
398 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
399
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
400 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
401 return GAIM_CMD_STATUS_OK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
402 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
403
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
404 static GaimCmdRet
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
405 help_command_cb(GaimConversation *conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
406 const char *cmd, char **args, char **error, void *data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
407 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
408 GList *l, *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
409 GString *s;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
410
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
411 if (args[0] != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
412 s = g_string_new("");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
413 text = gaim_cmd_help(conv, args[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
414
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
415 if (text) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
416 for (l = text; l; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
417 if (l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
418 g_string_append_printf(s, "%s\n", (char *)l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
419 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
420 g_string_append_printf(s, "%s", (char *)l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
421 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
422 g_string_append(s, _("No such command (in this context)."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
423 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
424 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
425 s = g_string_new(_("Use \"/help &lt;command&gt;\" for help on a specific command.\n"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
426 "The following commands are available in this context:\n"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
427
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
428 text = gaim_cmd_list(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
429 for (l = text; l; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
430 if (l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
431 g_string_append_printf(s, "%s, ", (char *)l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
432 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
433 g_string_append_printf(s, "%s.", (char *)l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
434 g_list_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
435 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
436
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
437 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
438 g_string_free(s, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
439
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
440 return GAIM_CMD_STATUS_OK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
441 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
442
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
443 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
444 send_history_add(GaimGtkConversation *gtkconv, const char *message)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
445 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
446 GList *first;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
447
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
448 first = g_list_first(gtkconv->send_history);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
449 g_free(first->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
450 first->data = g_strdup(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
451 gtkconv->send_history = g_list_prepend(first, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
452 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
453
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
454 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
455 check_for_and_do_command(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
456 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
457 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
458 char *cmd;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
459 const char *prefix;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
460 GtkTextIter start;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
461
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
462 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
463 prefix = gaim_gtk_get_cmd_prefix();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
464
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
465 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
466 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
467
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
468 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
469 && !gtk_text_iter_get_child_anchor(&start)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
470 GaimCmdStatus status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
471 char *error, *cmdline, *markup, *send_history;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
472 GtkTextIter end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
473
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
474 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
475 send_history_add(gtkconv, send_history);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
476 g_free(send_history);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
477
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
478 cmdline = cmd + strlen(prefix);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
479
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
480 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
481 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
482 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
483 status = gaim_cmd_do_command(conv, cmdline, markup, &error);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
484 g_free(cmd);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
485 g_free(markup);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
486
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
487 switch (status) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
488 case GAIM_CMD_STATUS_OK:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
489 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
490 case GAIM_CMD_STATUS_NOT_FOUND:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
491 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
492 case GAIM_CMD_STATUS_WRONG_ARGS:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
493 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
494 "to that command."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
495 GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
496 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
497 case GAIM_CMD_STATUS_FAILED:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
498 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
499 GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
500 g_free(error);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
501 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
502 case GAIM_CMD_STATUS_WRONG_TYPE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
503 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
504 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
505 GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
506 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
507 gaim_conversation_write(conv, "", _("That command only works in IMs, not chats."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
508 GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
509 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
510 case GAIM_CMD_STATUS_WRONG_PRPL:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
511 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
512 GAIM_MESSAGE_NO_LOG, time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
513 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
514 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
515 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
516
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
517 g_free(cmd);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
518 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
519 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
520
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
521 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
522 send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
523 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
524 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
525 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
526 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
527 GaimMessageFlags flags = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
528 char *buf, *clean;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
529
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
530 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
531
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
532 if (!gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
533 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
534
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
535 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
536 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
537 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
538
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
539 if (check_for_and_do_command(conv)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
540 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
541 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
542 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
543
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
544 buf = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
545 clean = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
546
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
547 gtk_widget_grab_focus(gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
548
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
549 if (strlen(clean) == 0) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
550 g_free(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
551 g_free(clean);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
552 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
553 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
555 gaim_idle_touch();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
556
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
557 /* XXX: is there a better way to tell if the message has images? */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
558 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
559 flags |= GAIM_MESSAGE_IMAGES;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
561 gc = gaim_account_get_connection(account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
562 if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
563 char **bufs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
564 int i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
565
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
566 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
567 for (i = 0; bufs[i]; i++) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
568 send_history_add(gtkconv, bufs[i]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
569 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
570 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), bufs[i], flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
571 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
572 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), bufs[i], flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
573 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
574
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
575 g_strfreev(bufs);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
576
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
577 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
578 send_history_add(gtkconv, buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
579 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
580 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), buf, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
581 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
582 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), buf, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
583 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
584
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
585 g_free(clean);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
586 g_free(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
587
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
588 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
589 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
590 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
591
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
592 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
593 add_remove_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
594 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
595 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
596 const char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
597 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
598
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
599 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
600 name = gaim_conversation_get_name(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
601
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
602 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
603 GaimBuddy *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
604
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
605 b = gaim_find_buddy(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
606 if (b != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
607 gaim_gtkdialogs_remove_buddy(b);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
608 else if (account != NULL && gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
609 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
610 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
611 GaimChat *c;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
613 c = gaim_blist_find_chat(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
614 if (c != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
615 gaim_gtkdialogs_remove_chat(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
616 else if (account != NULL && gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
617 gaim_blist_request_add_chat(account, NULL, NULL, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
618 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
619
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
620 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
621 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
622
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
623 static void chat_do_info(GaimGtkConversation *gtkconv, const char *who)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
624 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
625 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
626 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
627 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
628
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
629 if ((gc = gaim_conversation_get_gc(conv))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
630 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
631
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
632 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
633 * If there are special needs for getting info on users in
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
634 * buddy chat "rooms"...
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
635 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
636 if (prpl_info->get_cb_info != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
637 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
638 prpl_info->get_cb_info(gc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
639 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
640 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
641 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
642 prpl_info->get_info(gc, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
643 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
644 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
645
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
647 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
648 info_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
649 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
650 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
651
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
652 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
653 serv_get_info(gaim_conversation_get_gc(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
654 gaim_conversation_get_name(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
655
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
656 gtk_widget_grab_focus(gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
657 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
658 /* Get info of the person currently selected in the GtkTreeView */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
659 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
660 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
661 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
662 GtkTreeSelection *sel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
663 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
665 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
666
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
667 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
668 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
669
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
670 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
671 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
672 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
673 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
675 chat_do_info(gtkconv, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
676 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
677 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
678 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
679
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
680 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
681 block_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
682 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
683 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
684 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
685
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
686 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
687
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
688 if (account != NULL && gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
689 gaim_gtk_request_add_block(account, gaim_conversation_get_name(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
690
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
691 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
692 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
693
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
694 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
695 do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
696 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
697 const char *buddy, *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
698 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
699
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
700 gtkconv = GAIM_GTK_CONVERSATION(info->conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
701
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
702 if (resp == GTK_RESPONSE_OK) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
703 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
704 message = gtk_entry_get_text(GTK_ENTRY(info->message));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
705
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
706 if (!g_ascii_strcasecmp(buddy, ""))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
707 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
708
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
709 serv_chat_invite(gaim_conversation_get_gc(info->conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
710 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
711 message, buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
712 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
713
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
714 gtk_widget_destroy(invite_dialog);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
715 invite_dialog = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
716
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
717 g_free(info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
718 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
719
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
720 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
721 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
722 GtkSelectionData *sd, guint inf, guint t, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
723 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
724 InviteBuddyInfo *info = (InviteBuddyInfo *)data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
725 const char *convprotocol;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
727 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
728
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
729 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
730 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
731 GaimBlistNode *node = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
732 GaimBuddy *buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
733
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
734 memcpy(&node, sd->data, sizeof(node));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
735
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
736 if (GAIM_BLIST_NODE_IS_CONTACT(node))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
737 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
738 else if (GAIM_BLIST_NODE_IS_BUDDY(node))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
739 buddy = (GaimBuddy *)node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
740 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
741 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
742
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
743 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
744 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
745 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
746 _("That buddy is not on the same protocol as this "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
747 "chat."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
748 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
749 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
750 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
751
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
752 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
753 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
754 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
755 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
756 char *protocol = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
757 char *username = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
758 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
759
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
760 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
761 &protocol, &username, NULL))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
762 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
763 if (account == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
764 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
765 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
766 _("You are not currently signed on with an account that "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
767 "can invite that buddy."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
768 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
769 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
770 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
771 gaim_notify_error(GAIM_GTK_CONVERSATION(info->conv), NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
772 _("That buddy is not on the same protocol as this "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
773 "chat."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
774 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
775 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
776 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
777 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
778 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
779 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
780
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
781 g_free(username);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
782 g_free(protocol);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
783
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
784 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
785 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
786 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
787
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
788 static const GtkTargetEntry dnd_targets[] =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
789 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
790 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0},
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
791 {"application/x-im-contact", 0, 1}
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
792 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
793
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
794 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
795 invite_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
796 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
797 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
798 InviteBuddyInfo *info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
799
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
800 if (invite_dialog == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
801 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
802 GaimGtkWindow *gtkwin;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
803 GtkWidget *label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
804 GtkWidget *vbox, *hbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
805 GtkWidget *table;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
806 GtkWidget *img;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
807
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
808 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
809 GTK_ICON_SIZE_DIALOG);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
810
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
811 info = g_new0(InviteBuddyInfo, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
812 info->conv = conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
813
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
814 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
815 gtkwin = gaim_gtkconv_get_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
817 /* Create the new dialog. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
818 invite_dialog = gtk_dialog_new_with_buttons(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
819 _("Invite Buddy Into Chat Room"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
820 GTK_WINDOW(gtkwin->window), 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
821 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
822 GAIM_STOCK_INVITE, GTK_RESPONSE_OK, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
823
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
824 gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
825 GTK_RESPONSE_OK);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
826 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
827 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
828 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
829
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
830 info->window = GTK_WIDGET(invite_dialog);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
831
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
832 /* Setup the outside spacing. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
833 vbox = GTK_DIALOG(invite_dialog)->vbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
834
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
835 gtk_box_set_spacing(GTK_BOX(vbox), GAIM_HIG_BORDER);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
836 gtk_container_set_border_width(GTK_CONTAINER(vbox), GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
837
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
838 /* Setup the inner hbox and put the dialog's icon in it. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
839 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
840 gtk_container_add(GTK_CONTAINER(vbox), hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
841 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
842 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
843
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
844 /* Setup the right vbox. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
845 vbox = gtk_vbox_new(FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
846 gtk_container_add(GTK_CONTAINER(hbox), vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
847
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
848 /* Put our happy label in it. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
849 label = gtk_label_new(_("Please enter the name of the user you wish "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
850 "to invite, along with an optional invite "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
851 "message."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
852 gtk_widget_set_size_request(label, 350, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
853 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
854 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
855 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
856
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
857 /* hbox for the table, and to give it some spacing on the left. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
858 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
859 gtk_container_add(GTK_CONTAINER(vbox), hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
860
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
861 /* Setup the table we're going to use to lay stuff out. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
862 table = gtk_table_new(2, 2, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
863 gtk_table_set_row_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
864 gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
865 gtk_container_set_border_width(GTK_CONTAINER(table), GAIM_HIG_BORDER);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
866 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
867
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
868 /* Now the Buddy label */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
869 label = gtk_label_new(NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
870 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Buddy:"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
871 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
872 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
873
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
874 /* Now the Buddy drop-down entry field. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
875 info->entry = gtk_combo_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
876 gtk_combo_set_case_sensitive(GTK_COMBO(info->entry), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
877 gtk_entry_set_activates_default(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
878 GTK_ENTRY(GTK_COMBO(info->entry)->entry), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
879
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
880 gtk_table_attach_defaults(GTK_TABLE(table), info->entry, 1, 2, 0, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
881 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
883 /* Fill in the names. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
884 gtk_combo_set_popdown_strings(GTK_COMBO(info->entry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
885 generate_invite_user_names(gc));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
886
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
887
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
888 /* Now the label for "Message" */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
889 label = gtk_label_new(NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
890 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Message:"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
891 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
892 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
893
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
894
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
895 /* And finally, the Message entry field. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
896 info->message = gtk_entry_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
897 gtk_entry_set_activates_default(GTK_ENTRY(info->message), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
898
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
899 gtk_table_attach_defaults(GTK_TABLE(table), info->message, 1, 2, 1, 2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
900 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
901
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
902 /* Connect the signals. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
903 g_signal_connect(G_OBJECT(invite_dialog), "response",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
904 G_CALLBACK(do_invite), info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
905 /* Setup drag-and-drop */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
906 gtk_drag_dest_set(info->window,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
907 GTK_DEST_DEFAULT_MOTION |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
908 GTK_DEST_DEFAULT_DROP,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
909 dnd_targets,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
910 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
911 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
912 gtk_drag_dest_set(info->entry,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
913 GTK_DEST_DEFAULT_MOTION |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
914 GTK_DEST_DEFAULT_DROP,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
915 dnd_targets,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
916 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
917 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
918
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
919 g_signal_connect(G_OBJECT(info->window), "drag_data_received",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
920 G_CALLBACK(invite_dnd_recv), info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
921 g_signal_connect(G_OBJECT(info->entry), "drag_data_received",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
922 G_CALLBACK(invite_dnd_recv), info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
923
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
924 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
925
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
926 gtk_widget_show_all(invite_dialog);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
927
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
928 if (info != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
929 gtk_widget_grab_focus(GTK_COMBO(info->entry)->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
930 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
931
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
932 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
933 menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
934 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
935 gaim_gtkdialogs_im();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
936 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
937
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
938 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
939 savelog_writefile_cb(void *user_data, const char *filename)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
940 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
941 GaimConversation *conv = (GaimConversation *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
942 FILE *fp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
943 const char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
944 gchar *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
945
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
946 if ((fp = g_fopen(filename, "w+")) == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
947 gaim_notify_error(GAIM_GTK_CONVERSATION(conv), NULL, _("Unable to open file."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
948 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
949 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
950
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
951 name = gaim_conversation_get_name(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
952 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
953 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
954
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
955 text = gtk_imhtml_get_markup(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
956 GTK_IMHTML(GAIM_GTK_CONVERSATION(conv)->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
957 fprintf(fp, "%s", text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
958 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
959
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
960 fprintf(fp, "\n</body>\n</html>\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
961 fclose(fp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
962 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
963
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
964 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
965 * It would be kinda cool if this gave the option of saving a
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
966 * plaintext v. HTML file.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
967 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
968 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
969 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
970 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
971 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
972 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
973 gchar *buf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
974
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
975 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
976
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
977 gaim_request_file(GAIM_GTK_CONVERSATION(conv), _("Save Conversation"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
978 gaim_escape_filename(buf),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
979 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
980
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
981 g_free(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
982 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
983
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
984 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
985 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
986 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
987 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
988 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
989 GaimLogType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
990 GaimGtkBuddyList *gtkblist;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
991 GdkCursor *cursor;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
992 const char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
993 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
994 GSList *buddies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
995 GSList *cur;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
996
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
997 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
998
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
999 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1000 type = GAIM_LOG_IM;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1001 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1002 type = GAIM_LOG_CHAT;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1003 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1004 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1005
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1006 gtkblist = gaim_gtk_blist_get_default_gtk_blist();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1007
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1008 cursor = gdk_cursor_new(GDK_WATCH);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1009 gdk_window_set_cursor(gtkblist->window->window, cursor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1010 gdk_window_set_cursor(win->window->window, cursor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1011 gdk_cursor_unref(cursor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1012 #if GTK_CHECK_VERSION(2,4,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1013 gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1014 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1015 gdk_flush();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1016 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1017
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1018 name = gaim_conversation_get_name(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1019 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1020
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1021 buddies = gaim_find_buddies(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1022 for (cur = buddies; cur != NULL; cur = cur->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1023 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1024 GaimBlistNode *node = cur->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1025 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1026 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1027 gaim_gtk_log_show_contact((GaimContact *)node->parent);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1028 g_slist_free(buddies);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1029 gdk_window_set_cursor(gtkblist->window->window, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1030 gdk_window_set_cursor(win->window->window, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1031 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1032 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1033 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1034 g_slist_free(buddies);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1035
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1036 gaim_gtk_log_show(type, name, account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1037
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1038 gdk_window_set_cursor(gtkblist->window->window, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1039 gdk_window_set_cursor(win->window->window, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1040 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1041
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1042 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1043 menu_clear_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1044 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1045 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1046 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1047 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1048
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1049 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1050 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1051
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1052 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1053 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1054
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1055 struct _search {
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1056 GaimGtkWindow *gtkwin;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1057 GtkWidget *entry;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1058 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1059
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1060 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1061 {
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1062 GaimConversation *conv;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1063 GaimGtkConversation *gtk_active_conv;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1064 GList *iter;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1065
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1066 conv = gaim_gtk_conv_window_get_active_conversation(s->gtkwin);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1067 gtk_active_conv = GAIM_GTK_CONVERSATION(conv);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1068
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1069 switch (resp)
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1070 {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1071 case GTK_RESPONSE_OK:
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1072 /* clear highlighting except the active conversation window
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1073 * highlight the keywords in the active conversation window */
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1074 for (iter = gaim_gtk_conv_window_get_gtkconvs(s->gtkwin) ; iter ; iter = iter->next)
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1075 {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1076 GaimGtkConversation *gtkconv = iter->data;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1077
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1078 if (gtkconv != gtk_active_conv)
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1079 {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1080 gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1081 }
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1082 else
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1083 {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1084 gtk_imhtml_search_find(GTK_IMHTML(gtk_active_conv->imhtml),
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1085 gtk_entry_get_text(GTK_ENTRY(s->entry)));
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1086 }
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1087 }
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1088 break;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1089
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1090 case GTK_RESPONSE_DELETE_EVENT:
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1091 case GTK_RESPONSE_CLOSE:
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1092 /* clear the keyword highlighting in all the conversation windows */
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1093 for (iter = gaim_gtk_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next)
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1094 {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1095 GaimGtkConversation *gconv = iter->data;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1096 gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml));
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1097 }
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1098
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1099 gtk_widget_destroy(s->gtkwin->dialogs.search);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1100 s->gtkwin->dialogs.search = NULL;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1101 g_free(s);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1102 break;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1103 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1104 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1106 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1107 menu_find_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1108 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1109 GaimGtkWindow *gtkwin = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1110 GtkWidget *hbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1111 GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1112 GTK_ICON_SIZE_DIALOG);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1113 GtkWidget *label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1114 struct _search *s;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1115
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1116 if (gtkwin->dialogs.search) {
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1117 gtk_window_present(GTK_WINDOW(gtkwin->dialogs.search));
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1118 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1119 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1120
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1121 s = g_malloc(sizeof(struct _search));
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1122 s->gtkwin = gtkwin;
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1123
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1124 gtkwin->dialogs.search = gtk_dialog_new_with_buttons(_("Find"),
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1125 GTK_WINDOW(gtkwin->window), GTK_DIALOG_DESTROY_WITH_PARENT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1126 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1127 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL);
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1128 gtk_dialog_set_default_response(GTK_DIALOG(gtkwin->dialogs.search),
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1129 GTK_RESPONSE_OK);
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1130 g_signal_connect(G_OBJECT(gtkwin->dialogs.search), "response",
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1131 G_CALLBACK(do_search_cb), s);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1132
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1133 gtk_container_set_border_width(GTK_CONTAINER(gtkwin->dialogs.search), GAIM_HIG_BOX_SPACE);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1134 gtk_window_set_resizable(GTK_WINDOW(gtkwin->dialogs.search), FALSE);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1135 gtk_dialog_set_has_separator(GTK_DIALOG(gtkwin->dialogs.search), FALSE);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1136 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(gtkwin->dialogs.search)->vbox), GAIM_HIG_BORDER);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1137 gtk_container_set_border_width(
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1138 GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox), GAIM_HIG_BOX_SPACE);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1139
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1140 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1141 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(gtkwin->dialogs.search)->vbox),
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1142 hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1143 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1144
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1145 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1146 gtk_dialog_set_response_sensitive(GTK_DIALOG(gtkwin->dialogs.search),
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1147 GTK_RESPONSE_OK, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1148
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1149 label = gtk_label_new(NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1150 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1151 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1152
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1153 s->entry = gtk_entry_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1154 gtk_entry_set_activates_default(GTK_ENTRY(s->entry), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1155 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(s->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1156 g_signal_connect(G_OBJECT(s->entry), "changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1157 G_CALLBACK(gaim_gtk_set_sensitive_if_input),
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1158 gtkwin->dialogs.search);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1159 gtk_box_pack_start(GTK_BOX(hbox), s->entry, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1160
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
1161 gtk_widget_show_all(gtkwin->dialogs.search);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1162 gtk_widget_grab_focus(s->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1163 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1164
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1165 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1166 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1167 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1168 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1169 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1170
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1171 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1172 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1173 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1174
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1175 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1176
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1177 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1178 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1179 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1180 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1181 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1182
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1183 conv = gaim_gtk_conv_window_get_active_gtkconv(win)->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1184
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1185 gaim_gtk_pounce_editor_show(gaim_conversation_get_account(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1186 gaim_conversation_get_name(conv), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1187 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1189 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1190 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1191 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1192 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1193 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1194 GtkIMHtmlToolbar *toolbar;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1195
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1196 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1197 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1198
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1199 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1200 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1201 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1202
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1203 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1204 menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1205 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1206 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1207 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1208 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1209 GtkIMHtmlToolbar *toolbar;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1210
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1211 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1212 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1213 toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1215 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1216 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1217 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1218
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1219 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1220 menu_alias_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1221 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1222 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1223 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1224 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1225 const char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1226
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1227 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1228 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1229 name = gaim_conversation_get_name(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1230
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1231 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1232 GaimBuddy *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1233
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1234 b = gaim_find_buddy(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1235 if (b != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1236 gaim_gtkdialogs_alias_buddy(b);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1237 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1238 GaimChat *c;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1240 c = gaim_blist_find_chat(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1241 if (c != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1242 gaim_gtkdialogs_alias_chat(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1243 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1244 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1245
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1246 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1247 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1248 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1249 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1250 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1251
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1252 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1254 info_cb(NULL, GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1255 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1256
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1257 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1258 menu_invite_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1259 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1260 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1261 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1262
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1263 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1264
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1265 invite_cb(NULL, GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1266 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1267
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1268 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1269 menu_block_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1270 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1271 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1272 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1273
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1274 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1275
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1276 block_cb(NULL, GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1277 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1278
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1279 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1280 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1281 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1282 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1283 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1284
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1285 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1286
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1287 add_remove_cb(NULL, GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1288 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1289
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1290 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1291 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1292 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1293 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1294
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1295 close_conv_cb(NULL, GAIM_GTK_CONVERSATION(gaim_gtk_conv_window_get_active_conversation(win)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1296 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1297
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1298 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1299 menu_logging_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1300 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1301 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1302 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1303 gboolean logging;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1304
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1305 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1306
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1307 if (conv == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1308 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1309
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1310 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1311
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1312 if (logging == gaim_conversation_is_logging(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1313 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1314
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1315 if (logging)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1316 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1317 /* Enable logging first so the message below can be logged. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1318 gaim_conversation_set_logging(conv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1319
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1320 gaim_conversation_write(conv, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1321 _("Logging started. Future messages in this conversation will be logged."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1322 conv->logs ? (GAIM_MESSAGE_SYSTEM) :
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1323 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1324 time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1325 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1326 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1327 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1328 gaim_conversation_write(conv, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1329 _("Logging stopped. Future messages in this conversation will not be logged."),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1330 conv->logs ? (GAIM_MESSAGE_SYSTEM) :
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1331 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1332 time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1333
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1334 /* Disable the logging second, so that the above message can be logged. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1335 gaim_conversation_set_logging(conv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1336 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1337 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1338
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1339 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1340 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1341 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1342 gaim_prefs_set_bool("/gaim/gtk/conversations/show_formatting_toolbar",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1343 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1344 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1345
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1346 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1347 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1348 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1349 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1350 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1351 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1352
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1353 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1354
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1355 if (!conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1356 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1357
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1358 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1359
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1360 gtkconv->make_sound =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1361 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1362 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1363
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1364 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1365 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1366 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1367 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1368 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1369 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1370
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1371 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1372 chat_do_im(GaimGtkConversation *gtkconv, const char *who)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1373 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1374 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1375 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1376 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1377 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1378 char *real_who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1379
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1380 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1381 g_return_if_fail(account != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1382
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1383 gc = gaim_account_get_connection(account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1384 g_return_if_fail(gc != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1385
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1386 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1387
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1388 if (prpl_info && prpl_info->get_cb_real_name)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1389 real_who = prpl_info->get_cb_real_name(gc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1390 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1391 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1392 real_who = g_strdup(who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1393
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1394 if(!real_who)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1395 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1396
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1397 gaim_gtkdialogs_im_with_user(account, real_who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1398
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1399 g_free(real_who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1400 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1401
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1402 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1403 ignore_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1404 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1405 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1406 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1407 GaimConvChatBuddy *cbuddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1408 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1409 GaimConvChatBuddyFlags flags;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1410 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1411 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1412 GtkTreeSelection *sel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1413 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1414 char *alias;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1416 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1417 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1418
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1419 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1420 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1421
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1422 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1423 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1424 CHAT_USERS_NAME_COLUMN, &name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1425 CHAT_USERS_ALIAS_COLUMN, &alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1426 CHAT_USERS_FLAGS_COLUMN, &flags,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1427 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1428 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1429 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1430 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1431 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1432
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1433 if (gaim_conv_chat_is_user_ignored(chat, name))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1434 gaim_conv_chat_unignore(chat, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1435 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1436 gaim_conv_chat_ignore(chat, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1437
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1438 cbuddy = gaim_conv_chat_cb_new(name, alias, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1439
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1440 add_chat_buddy_common(conv, cbuddy, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1441 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1442 g_free(alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1443 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1444
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1445 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1446 menu_chat_im_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1447 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1448 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1449
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1450 chat_do_im(gtkconv, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1451 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1452
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1453 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1454 menu_chat_send_file_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1455 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1456 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1457 const char *who = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1458 GaimConnection *gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1459
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1460 serv_send_file(gc, who, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1461 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1462
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1463 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1464 menu_chat_info_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1465 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1466 char *who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1467
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1468 who = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1469
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1470 chat_do_info(gtkconv, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1471 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1472
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1473 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1474 menu_chat_get_away_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1475 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1476 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1477 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1478 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1479 char *who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1480
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1481 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1482 who = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1483
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1484 if (gc != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1485 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1486
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1487 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1488 * May want to expand this to work similarly to menu_info_cb?
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1489 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1490
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1491 if (prpl_info->get_cb_away != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1492 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1493 prpl_info->get_cb_away(gc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1494 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1495 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1496 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1497 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1498
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1499 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1500 menu_chat_add_remove_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1501 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1502 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1503 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1504 GaimBuddy *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1505 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1507 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1508 name = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1509 b = gaim_find_buddy(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1510
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1511 if (b != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1512 gaim_gtkdialogs_remove_buddy(b);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1513 else if (account != NULL && gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1514 gaim_blist_request_add_buddy(account, name, NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1515
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1516 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1517 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1518
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1519 static GtkTextMark *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1520 get_mark_for_user(GaimGtkConversation *gtkconv, const char *who)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1521 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1522 GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1523 char *tmp = g_strconcat("user:", who, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1524 GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1525
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1526 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1527 return mark;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1528 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1529
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1530 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1531 menu_last_said_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1532 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1533 GtkTextMark *mark;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1534 const char *who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1535
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1536 who = g_object_get_data(G_OBJECT(w), "user_data");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1537 mark = get_mark_for_user(gtkconv, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1538
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1539 if (mark != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1540 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1541 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1542 g_return_if_reached();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1543 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1544
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1545 static GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1546 create_chat_menu(GaimConversation *conv, const char *who, GaimConnection *gc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1547 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1548 static GtkWidget *menu = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1549 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1550 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1551 gboolean is_me = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1552 GtkWidget *button;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1553 GaimBuddy *buddy = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1555 if (gc != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1556 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1557
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1558 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1559 * If a menu already exists, destroy it before creating a new one,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1560 * thus freeing-up the memory it occupied.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1561 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1562 if (menu)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1563 gtk_widget_destroy(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1564
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1565 if (!strcmp(chat->nick, gaim_normalize(conv->account, who)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1566 is_me = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1567
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1568 menu = gtk_menu_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1569
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1570 if (!is_me) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1571 button = gaim_new_item_from_stock(menu, _("IM"), GAIM_STOCK_IM,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1572 G_CALLBACK(menu_chat_im_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1573
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1574 if (gc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1575 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1576
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1577 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1578
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1579
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1580 if (prpl_info && prpl_info->send_file)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1581 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1582 button = gaim_new_item_from_stock(menu, _("Send File"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1583 GAIM_STOCK_FILE_TRANSFER, G_CALLBACK(menu_chat_send_file_cb),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1584 GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1585
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1586 if (gc == NULL || prpl_info == NULL ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1587 !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1588 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1589 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1590 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1591
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1592 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1593 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1594
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1595
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1596 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1597 button = gaim_new_item_from_stock(menu, _("Un-Ignore"), GAIM_STOCK_IGNORE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1598 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1599 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1600 button = gaim_new_item_from_stock(menu, _("Ignore"), GAIM_STOCK_IGNORE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1601 G_CALLBACK(ignore_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1602
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1603 if (gc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1604 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1605
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1606 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1607 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1608
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1609 if (prpl_info && (prpl_info->get_info || prpl_info->get_cb_info)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1610 button = gaim_new_item_from_stock(menu, _("Info"), GAIM_STOCK_INFO,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1611 G_CALLBACK(menu_chat_info_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1613 if (gc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1614 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1615
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1616 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1617 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1618
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1619 if (prpl_info && prpl_info->get_cb_away) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1620 button = gaim_new_item_from_stock(menu, _("Get Away Message"), GAIM_STOCK_AWAY,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1621 G_CALLBACK(menu_chat_get_away_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1622
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1623 if (gc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1624 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1625
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1626 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1627 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1628
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1629 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1630 if ((buddy = gaim_find_buddy(conv->account, who)) != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1631 button = gaim_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1632 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1633 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1634 button = gaim_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1635 G_CALLBACK(menu_chat_add_remove_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1636
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1637 if (gc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1638 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1639
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1640 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1641 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1642
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1643 button = gaim_new_item_from_stock(menu, _("Last said"), GTK_STOCK_INDEX,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1644 G_CALLBACK(menu_last_said_cb), GAIM_GTK_CONVERSATION(conv), 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1645 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1646 if (!get_mark_for_user(GAIM_GTK_CONVERSATION(conv), who))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1647 gtk_widget_set_sensitive(button, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1648
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1649 if (buddy != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1650 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1651 if (gaim_account_is_connected(conv->account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1652 gaim_gtk_append_blist_node_proto_menu(menu, conv->account->gc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1653 (GaimBlistNode *)buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1654 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1655 gtk_widget_show_all(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1656 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1657
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1658 return menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1659 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1660
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1661
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1662 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1663 gtkconv_chat_popup_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1664 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1665 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1666 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1667 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1668 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1669 GtkTreeSelection *sel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1670 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1671 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1672 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1673 gchar *who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1675 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1676 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1677 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1678 gc = account->gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1679
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1680 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1681
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1682 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1683 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1684 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1685
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1686 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1687 menu = create_chat_menu (conv, who, gc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1688 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1689 gaim_gtk_treeview_popup_menu_position_func, widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1690 0, GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1691 g_free(who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1692
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1693 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1694 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1695
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1696
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1697 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1698 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1699 GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1700 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1701 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1702 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1703 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1704 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1705 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1706 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1707 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1708 GtkTreeViewColumn *column;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1709 gchar *who;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1710 int x, y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1711
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1712 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1713 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1714 gc = account->gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1715
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1716 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1717
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1718 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1719 event->x, event->y, &path, &column, &x, &y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1720
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1721 if (path == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1722 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1723
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1724 gtk_tree_selection_select_path(GTK_TREE_SELECTION(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1725 gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list))), path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1727 gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1728 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1729
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1730 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1731 chat_do_im(gtkconv, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1732 } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1733 /* Move to user's anchor */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1734 GtkTextMark *mark = get_mark_for_user(gtkconv, who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1735
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1736 if(mark != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1737 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1738 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1739 GtkWidget *menu = create_chat_menu (conv, who, gc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1740 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1741 event->button, event->time);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1742 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1743
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1744 g_free(who);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1745 gtk_tree_path_free(path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1746
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1747 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1748 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1749
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1750 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1751 move_to_next_unread_tab(GaimGtkConversation *gtkconv, gboolean forward)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1752 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1753 GaimGtkConversation *next_gtkconv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1754 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1755 int initial, i, total, diff;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1756
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1757 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1758 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1759 gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1760 total = gaim_gtk_conv_window_get_gtkconv_count(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1761 /* By adding total here, the moduli calculated later will always have two
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1762 * positive arguments. x % y where x < 0 is not guaranteed to return a
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1763 * positive number.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1764 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1765 diff = (forward ? 1 : -1) + total;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1766
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1767 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1768 next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1769 if (next_gtkconv->unseen_state > 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1770 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1771 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1772
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1773 if (i == initial) { /* no new messages */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1774 i = (i + diff) % total;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1775 next_gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1776 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1777
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1778 if (next_gtkconv != NULL && next_gtkconv != gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1779 gaim_gtk_conv_window_switch_gtkconv(win, next_gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1780 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1781
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1782 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1783 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1784 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1785 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1786 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1787 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1788 int curconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1789
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1790 gtkconv = (GaimGtkConversation *)data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1791 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1792 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1793 curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1794
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1795 /* If CTRL was held down... */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1796 if (event->state & GDK_CONTROL_MASK) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1797 switch (event->keyval) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1798 case GDK_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1799 if (!gtkconv->send_history)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1800 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1801
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1802 if (!gtkconv->send_history->prev) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1803 GtkTextIter start, end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1804
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1805 g_free(gtkconv->send_history->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1806
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1807 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1808 &start);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1809 gtk_text_buffer_get_end_iter(gtkconv->entry_buffer, &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1810
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1811 gtkconv->send_history->data =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1812 gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1813 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1814
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1815 if (gtkconv->send_history->next && gtkconv->send_history->next->data) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1816 GObject *object;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1817 GtkTextIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1818 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1819
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1820 gtkconv->send_history = gtkconv->send_history->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1821
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1822 /* Block the signal to prevent application of default formatting. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1823 object = g_object_ref(G_OBJECT(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1824 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1825 NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1826 /* Clear the formatting. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1827 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1828 /* Unblock the signal. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1829 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1830 NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1831 g_object_unref(object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1832
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1833 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1834 gtk_imhtml_append_text_with_images(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1835 GTK_IMHTML(gtkconv->entry), gtkconv->send_history->data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1836 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1837 /* this is mainly just a hack so the formatting at the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1838 * cursor gets picked up. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1839 gtk_text_buffer_get_end_iter(buffer, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1840 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1841 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1842
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1843 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1844 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1845
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1846 case GDK_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1847 if (!gtkconv->send_history)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1848 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1849
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1850 if (gtkconv->send_history->prev && gtkconv->send_history->prev->data) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1851 GObject *object;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1852 GtkTextIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1853 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1854
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1855 gtkconv->send_history = gtkconv->send_history->prev;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1856
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1857 /* Block the signal to prevent application of default formatting. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1858 object = g_object_ref(G_OBJECT(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1859 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1860 NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1861 /* Clear the formatting. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1862 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1863 /* Unblock the signal. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1864 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1865 NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1866 g_object_unref(object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1867
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1868 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1869 gtk_imhtml_append_text_with_images(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1870 GTK_IMHTML(gtkconv->entry), gtkconv->send_history->data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1871 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1872 /* this is mainly just a hack so the formatting at the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1873 * cursor gets picked up. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1874 if (*(char *)gtkconv->send_history->data) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1875 gtk_text_buffer_get_end_iter(buffer, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1876 gtk_text_buffer_move_mark_by_name(buffer, "insert", &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1877 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1878 /* Restore the default formatting */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1879 default_formatize(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1880 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1881 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1883 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1884 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1885
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1886 case GDK_Page_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1887 case ']':
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1888 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv + 1))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1889 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1890 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1891 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv + 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1892 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1893 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1894
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1895 case GDK_Page_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1896 case '[':
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1897 if (!gaim_gtk_conv_window_get_gtkconv_at_index(win, curconv - 1))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1898 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1899 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1900 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), curconv - 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1901 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1902 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1903
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1904 case GDK_Tab:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1905 case GDK_ISO_Left_Tab:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1906 if (event->state & GDK_SHIFT_MASK) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1907 move_to_next_unread_tab(gtkconv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1908 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1909 move_to_next_unread_tab(gtkconv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1910 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1911
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1912 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1913 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1914
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1915 case GDK_comma:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1916 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1917 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1918 curconv - 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1919 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1920
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1921 case GDK_period:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1922 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1923 gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1924 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1925 (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1926 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1927 (curconv + 1) % g_list_length(GTK_NOTEBOOK(win->notebook)->children));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1928 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1929 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1930
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1931 } /* End of switch */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1932 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1933
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1934 /* If ALT (or whatever) was held down... */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1935 else if (event->state & GDK_MOD1_MASK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1936 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1937 if (event->keyval > '0' && event->keyval <= '9')
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1938 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1939 guint switchto = event->keyval - '1';
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1940 if (switchto < gaim_gtk_conv_window_get_gtkconv_count(win))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1941 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), switchto);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1943 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1944 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1945 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1946
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1947 /* If neither CTRL nor ALT were held down... */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1948 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1949 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1950 switch (event->keyval)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1951 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1952 case GDK_Tab:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1953 return tab_complete(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1954 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1955
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1956 case GDK_Page_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1957 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1958 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1959 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1960
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1961 case GDK_Page_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1962 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1963 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1964 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1965
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1966 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1967 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1968 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1969 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1970
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1971 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1972 * NOTE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1973 * This guy just kills a single right click from being propagated any
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1974 * further. I have no idea *why* we need this, but we do ... It
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1975 * prevents right clicks on the GtkTextView in a convo dialog from
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1976 * going all the way down to the notebook. I suspect a bug in
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1977 * GtkTextView, but I'm not ready to point any fingers yet.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1978 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1979 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1980 entry_stop_rclick_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1981 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1982 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1983 /* Right single click */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1984 g_signal_stop_emission_by_name(G_OBJECT(widget), "button_press_event");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1985
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1986 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1987 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1988
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1989 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1990 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1991
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1992 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1993 * If someone tries to type into the conversation backlog of a
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1994 * conversation window then we yank focus from the conversation backlog
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1995 * and give it to the text entry box so that people can type
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1996 * all the live long day and it will get entered into the entry box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1997 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1998 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1999 refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2000 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2001 GaimGtkConversation *gtkconv = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2002
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2003 /* If we have a valid key for the conversation display, then exit */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2004 if ((event->state & GDK_CONTROL_MASK) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2005 (event->keyval == GDK_F10) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2006 (event->keyval == GDK_Shift_L) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2007 (event->keyval == GDK_Shift_R) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2008 (event->keyval == GDK_Escape) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2009 (event->keyval == GDK_Up) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2010 (event->keyval == GDK_Down) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2011 (event->keyval == GDK_Left) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2012 (event->keyval == GDK_Right) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2013 (event->keyval == GDK_Home) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2014 (event->keyval == GDK_End) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2015 (event->keyval == GDK_Tab) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2016 (event->keyval == GDK_ISO_Left_Tab))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2017 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2018
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2019 if (event->type == GDK_KEY_RELEASE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2020 gtk_widget_grab_focus(gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2021
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2022 gtk_widget_event(gtkconv->entry, (GdkEvent *)event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2023
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2024 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2025 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2026
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2027 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2028 gaim_gtkconv_switch_active_conversation(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2029 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2030 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2031 GaimConversation *old_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2032 GtkIMHtml *entry;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2033 const char *protocol_name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2034
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2035 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2036
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2037 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2038 old_conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2039
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2040 if (old_conv == conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2041 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2042
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2043 gaim_conversation_close_logs(old_conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2044 gtkconv->active_conv = conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2045
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2046 gaim_conversation_set_logging(conv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2047 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2048
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2049 entry = GTK_IMHTML(gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2050 protocol_name = gaim_account_get_protocol_name(conv->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2051 gtk_imhtml_set_protocol_name(entry, protocol_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2052 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2053
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2054 if (!(conv->features & GAIM_CONNECTION_HTML))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2055 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2056 else if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2057 !(old_conv->features & GAIM_CONNECTION_FORMATTING_WBFO))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2058 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2059 /* The old conversation allowed formatting on parts of the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2060 * buffer, but the new one only allows it on the whole
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2061 * buffer. This code saves the formatting from the current
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2062 * position of the cursor, clears the formatting, then
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2063 * applies the saved formatting to the entire buffer. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2064
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2065 gboolean bold;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2066 gboolean italic;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2067 gboolean underline;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2068 char *fontface = gtk_imhtml_get_current_fontface(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2069 char *forecolor = gtk_imhtml_get_current_forecolor(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2070 char *backcolor = gtk_imhtml_get_current_backcolor(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2071 char *background = gtk_imhtml_get_current_background(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2072 gint fontsize = gtk_imhtml_get_current_fontsize(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2073 gboolean bold2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2074 gboolean italic2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2075 gboolean underline2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2076
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2077 gtk_imhtml_get_current_format(entry, &bold, &italic, &underline);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2078
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2079 /* Clear existing formatting */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2080 gtk_imhtml_clear_formatting(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2081
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2082 /* Apply saved formatting to the whole buffer. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2083
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2084 gtk_imhtml_get_current_format(entry, &bold2, &italic2, &underline2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2085
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2086 if (bold != bold2)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2087 gtk_imhtml_toggle_bold(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2088
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2089 if (italic != italic2)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2090 gtk_imhtml_toggle_italic(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2091
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2092 if (underline != underline2)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2093 gtk_imhtml_toggle_underline(entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2094
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2095 gtk_imhtml_toggle_fontface(entry, fontface);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2096
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2097 if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2098 gtk_imhtml_font_set_size(entry, fontsize);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2099
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2100 gtk_imhtml_toggle_forecolor(entry, forecolor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2101
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2102 if (!(conv->features & GAIM_CONNECTION_NO_BGCOLOR))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2103 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2104 gtk_imhtml_toggle_backcolor(entry, backcolor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2105 gtk_imhtml_toggle_background(entry, background);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2106 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2107
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2108 g_free(fontface);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2109 g_free(forecolor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2110 g_free(backcolor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2111 g_free(background);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2112 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2113 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2114 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2115 /* This is done in default_formatize, which is called from clear_formatting_cb,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2116 * which is (obviously) a clear_formatting signal handler. However, if we're
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2117 * here, we didn't call gtk_imhtml_clear_formatting() (because we want to
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2118 * preserve the formatting exactly as it is), so we have to do this now. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2119 gtk_imhtml_set_whole_buffer_formatting_only(entry,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2120 (conv->features & GAIM_CONNECTION_FORMATTING_WBFO));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2121 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2122
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2123 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-switched", conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2124
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2125 gray_stuff_out(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2126 update_typing_icon(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2127
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2128 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2129 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2130 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2131
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2132 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2133 menu_conv_sel_send_cb(GObject *m, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2134 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2135 GaimAccount *account = g_object_get_data(m, "gaim_account");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2136 gchar *name = g_object_get_data(m, "gaim_buddy_name");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2137 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2138
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2139 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2140 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2141
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2142 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2143 gaim_gtkconv_switch_active_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2144 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2145
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2146 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2147 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2148 gchar *new_text, gint new_text_length, gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2149 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2150 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2151 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2152
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2153 g_return_if_fail(gtkconv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2154
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2155 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2156
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2157 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2158 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2159
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2160 got_typing_keypress(gtkconv, (gtk_text_iter_is_start(position) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2161 gtk_text_iter_is_end(position)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2162 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2163
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2164 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2165 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2166 GtkTextIter *end_pos, gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2167 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2168 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2169 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2170 GaimConvIm *im;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2171
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2172 g_return_if_fail(gtkconv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2173
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2174 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2175
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2176 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2177 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2178
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2179 im = GAIM_CONV_IM(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2180
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2181 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2182
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2183 /* We deleted all the text, so turn off typing. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2184 gaim_conv_im_stop_send_typed_timeout(im);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2186 serv_send_typing(gaim_conversation_get_gc(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2187 gaim_conversation_get_name(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2188 GAIM_NOT_TYPING);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2189 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2190 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2191 /* We're deleting, but not all of it, so it counts as typing. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2192 got_typing_keypress(gtkconv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2193 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2194 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2195
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2196 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2197 * A bunch of buddy icon functions
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2198 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2199 GdkPixbuf *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2200 gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2201 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2202 GaimAccount *account = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2203 const char *name = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2204 GdkPixbuf *status = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2205 GaimBlistUiOps *ops = gaim_blist_get_ui_ops();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2206
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2207 g_return_val_if_fail(conv != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2208
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2209 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2210 name = gaim_conversation_get_name(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2211
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2212 g_return_val_if_fail(account != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2213 g_return_val_if_fail(name != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2215 /* Use the buddy icon, if possible */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2216 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2217 GaimBuddy *b = gaim_find_buddy(account, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2218 if (b != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2219 /* I hate this hack. It fixes a bug where the pending message icon
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2220 * displays in the conv tab even though it shouldn't.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2221 * A better solution would be great. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2222 if (ops && ops->update)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2223 ops->update(NULL, (GaimBlistNode*)b);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2224
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2225 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2226 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2227 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2228 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2229
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2230 /* If they don't have a buddy icon, then use the PRPL icon */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2231 if (status == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2232 status = gaim_gtk_create_prpl_icon(account, small_icon ? 0.5 : 1.0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2233
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2234 return status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2235 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2236
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2237 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2238 update_tab_icon(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2239 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2240 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2241 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2242 GdkPixbuf *status = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2243
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2244 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2245
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2246 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2247 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2248 if (conv != gtkconv->active_conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2249 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2250
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2251 status = gaim_gtkconv_get_tab_icon(conv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2252
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2253 g_return_if_fail(status != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2254
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2255 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2256 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2257
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2258 if (status != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2259 g_object_unref(status);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2260
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2261 if (gaim_gtk_conv_window_is_active_conversation(conv) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2262 (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2263 gtkconv->u.im->anim == NULL))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2264 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2265 status = gaim_gtkconv_get_tab_icon(conv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2266
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2267 gtk_window_set_icon(GTK_WINDOW(win->window), status);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2268
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2269 if (status != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2270 g_object_unref(status);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2271 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2272 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2273
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
2274 /* This gets added as an idle handler when doing something that
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2275 * redraws the icon. It sets the auto_resize gboolean to TRUE.
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2276 * This way, when the size_allocate callback gets triggered, it notices
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2277 * that this is an autoresize, and after the main loop iterates, it
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2278 * gets set back to FALSE
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2279 */
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2280 static gboolean reset_auto_resize_cb(gpointer data)
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2281 {
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2282 GaimGtkConversation *gtkconv = (GaimGtkConversation *)data;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2283 gtkconv->auto_resize = FALSE;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2284 return FALSE;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2285 }
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2286
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2287 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2288 redraw_icon(gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2289 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2290 GaimGtkConversation *gtkconv = (GaimGtkConversation *)data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2291 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2292 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2293 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2294
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2295 GdkPixbuf *buf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2296 GdkPixbuf *scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2297 gint delay;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2298 int scale_width, scale_height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2299
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2300 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2301 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2302 if(account && account->gc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2303 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2304
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2305 gtkconv->auto_resize = TRUE;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
2306 g_idle_add(reset_auto_resize_cb, gtkconv);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
2307
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2308 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2309 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2310
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2311 gaim_gtk_buddy_icon_get_scale_size(buf, prpl_info ? &prpl_info->icon_spec :
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2312 NULL, &scale_width, &scale_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2313
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2314 /* this code is ugly, and scares me */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2315 scale = gdk_pixbuf_scale_simple(buf,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2316 MAX(gdk_pixbuf_get_width(buf) * scale_width /
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2317 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2318 MAX(gdk_pixbuf_get_height(buf) * scale_height /
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2319 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2320 GDK_INTERP_BILINEAR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2321
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2322 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->u.im->icon), scale);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2323 g_object_unref(G_OBJECT(scale));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2324 gtk_widget_queue_draw(gtkconv->u.im->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2325
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2326 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2327
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2328 if (delay < 100)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2329 delay = 100;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2330
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2331 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2332
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2333 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2334 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2335
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2336 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2337 start_anim(GtkObject *obj, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2338 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2339 int delay;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2340
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2341 if (gtkconv->u.im->anim == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2342 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2343
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2344 if (gtkconv->u.im->icon_timer != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2345 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2346
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2347 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2348 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2349
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2350 delay = gdk_pixbuf_animation_iter_get_delay_time(gtkconv->u.im->iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2352 if (delay < 100)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2353 delay = 100;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2354
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2355 gtkconv->u.im->icon_timer = g_timeout_add(delay, redraw_icon, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2356 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2357
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2358 static void
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2359 remove_icon(GtkWidget *widget, GaimGtkConversation *gtkconv)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2360 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2361 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2362 GaimGtkWindow *gtkwin;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2363
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2364 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2365
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2366 if (gtkconv->u.im->icon_container != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2367 gtk_widget_destroy(gtkconv->u.im->icon_container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2368
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2369 if (gtkconv->u.im->anim != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2370 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2372 if (gtkconv->u.im->icon_timer != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2373 g_source_remove(gtkconv->u.im->icon_timer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2375 if (gtkconv->u.im->iter != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2376 g_object_unref(G_OBJECT(gtkconv->u.im->iter));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2377
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2378 gtkconv->u.im->icon_timer = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2379 gtkconv->u.im->icon = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2380 gtkconv->u.im->anim = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2381 gtkconv->u.im->iter = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2382 gtkconv->u.im->icon_container = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2383 gtkconv->u.im->show_icon = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2384
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2385 gtkwin = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2386 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkwin->menu.show_icon), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2387 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2388
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2389 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2390 saveicon_writefile_cb(void *user_data, const char *filename)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2391 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2392 GaimGtkConversation *gtkconv = (GaimGtkConversation *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2393 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2394 FILE *fp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2395 GaimBuddyIcon *icon;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2396 const void *data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2397 size_t len;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2398
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2399 if ((fp = g_fopen(filename, "wb")) == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2400 gaim_notify_error(gtkconv, NULL, _("Unable to open file."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2401 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2402 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2403
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2404 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2405 data = gaim_buddy_icon_get_data(icon, &len);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2406
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2407 if ((len <= 0) || (data == NULL)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2408 gaim_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2409 fclose(fp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2410 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2411 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2412
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2413 fwrite(data, 1, len, fp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2414 fclose(fp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2415 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2416
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2417 static const char *
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2418 custom_icon_pref_name(GaimGtkConversation *gtkconv)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2419 {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2420 GaimConversation *conv;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2421 GaimAccount *account;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2422 GaimBuddy *buddy;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2423
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2424 conv = gtkconv->active_conv;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2425 account = gaim_conversation_get_account(conv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2426 buddy = gaim_find_buddy(account, gaim_conversation_get_name(conv));
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2427 if (buddy) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2428 GaimContact *contact = gaim_buddy_get_contact(buddy);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2429 return gaim_blist_node_get_string((GaimBlistNode*)contact, "custom_buddy_icon");
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2430 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2431 return NULL;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2432 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2433
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2434 static void
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2435 custom_icon_sel_cb(const char *filename, gpointer data)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2436 {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2437 if (filename) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2438 GaimGtkConversation *gtkconv = data;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2439 GaimConversation *conv = gtkconv->active_conv;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2440 GaimAccount *account = gaim_conversation_get_account(conv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2441 gaim_gtk_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), filename);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2442 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2443 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2444
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2445 static void
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2446 set_custom_icon_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2447 {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2448 GtkWidget *win = gaim_gtk_buddy_icon_chooser_new(GTK_WINDOW(gtkconv->win->window),
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2449 custom_icon_sel_cb, gtkconv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2450 gtk_widget_show_all(win);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2451 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2452
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2453 static void
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2454 remove_custom_icon_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2455 {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2456 GaimConversation *conv;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2457 GaimAccount *account;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2458
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2459 conv = gtkconv->active_conv;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2460 account = gaim_conversation_get_account(conv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2461 gaim_gtk_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), NULL);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2462 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2463
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2464 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2465 icon_menu_save_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2466 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2467 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2468 const gchar *ext;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2469 gchar *buf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2470
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2471 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2472
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2473 ext = gaim_buddy_icon_get_type(gaim_conv_im_get_icon(GAIM_CONV_IM(conv)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2474 if (ext == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2475 ext = "icon";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2476
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2477 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2478
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2479 gaim_request_file(gtkconv, _("Save Icon"), buf, TRUE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2480 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2481
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2482 g_free(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2483 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2484
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2485 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2486 stop_anim(GtkObject *obj, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2487 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2488 if (gtkconv->u.im->icon_timer != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2489 g_source_remove(gtkconv->u.im->icon_timer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2490
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2491 gtkconv->u.im->icon_timer = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2492 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2493
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2494
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2495 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2496 toggle_icon_animate_cb(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2497 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2498 gtkconv->u.im->animate =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2499 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2500
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2501 if (gtkconv->u.im->animate)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2502 start_anim(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2503 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2504 stop_anim(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2505 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2507 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2508 icon_menu(GtkObject *obj, GdkEventButton *e, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2509 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2510 static GtkWidget *menu = NULL;
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2511 const char *pref;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2512
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2513 if (e->button != 3 || e->type != GDK_BUTTON_PRESS)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2514 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2515
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2516 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2517 * If a menu already exists, destroy it before creating a new one,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2518 * thus freeing-up the memory it occupied.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2519 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2520 if (menu != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2521 gtk_widget_destroy(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2522
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2523 menu = gtk_menu_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2524
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2525 if (gtkconv->u.im->anim &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2526 !(gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2527 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2528 gaim_new_check_item(menu, _("Animate"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2529 G_CALLBACK(toggle_icon_animate_cb), gtkconv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2530 gtkconv->u.im->icon_timer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2531 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2532
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2533 gaim_new_item_from_stock(menu, _("Hide Icon"), NULL, G_CALLBACK(remove_icon),
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2534 gtkconv, 0, 0, NULL);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2535
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2536 gaim_new_item_from_stock(menu, _("Save Icon As..."), GTK_STOCK_SAVE_AS,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2537 G_CALLBACK(icon_menu_save_cb), gtkconv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2538 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2539
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2540 gaim_new_item_from_stock(menu, _("Set Custom Icon..."), NULL,
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2541 G_CALLBACK(set_custom_icon_cb), gtkconv,
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2542 0, 0, NULL);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2543
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2544 /* Is there a custom icon for this person? */
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2545 pref = custom_icon_pref_name(gtkconv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2546 if (pref && *pref) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2547 gaim_new_item_from_stock(menu, _("Remove Custom Icon"), NULL,
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2548 G_CALLBACK(remove_custom_icon_cb), gtkconv,
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2549 0, 0, NULL);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2550 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2551
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2552 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2553
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2554 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2555 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2556
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2557 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2558 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2559 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2560 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2561 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2562 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2563 gboolean active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2564
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2565 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2566
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2567 if (!conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2568 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2569
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2570 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2571
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2572 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2573
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2574 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2575 gtkconv->u.im->show_icon = active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2576 if (active)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2577 gaim_gtkconv_update_buddy_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2578 else
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
2579 remove_icon(NULL, gtkconv);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2580 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2581
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2582 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2583 * End of the bunch of buddy icon functions
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2584 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2585 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2586 gaim_gtkconv_present_conversation(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2587 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2588 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2589
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2590 if(gtkconv->win==hidden_convwin) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2591 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2592 gaim_gtkconv_placement_place(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2593 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2594
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2595 gaim_gtkconv_switch_active_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2596 gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2597 gtk_window_present(GTK_WINDOW(gtkconv->win->window));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2598 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2599
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2600 GList *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2601 gaim_gtk_conversations_find_unseen_list(GaimConversationType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2602 GaimUnseenState min_state,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2603 gboolean hidden_only,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2604 guint max_count)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2605 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2606 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2607 GList *r = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2608 guint c = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2609
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2610 if (type == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2611 l = gaim_get_ims();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2612 } else if (type == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2613 l = gaim_get_chats();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2614 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2615 l = gaim_get_conversations();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2616 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2617
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2618 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2619 GaimConversation *conv = (GaimConversation*)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2620 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2621
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2622 if(gtkconv->active_conv != conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2623 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2624
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2625 if (gtkconv->unseen_state >= min_state
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2626 && (!hidden_only ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2627 (hidden_only && gtkconv->win == hidden_convwin))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2628
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2629 r = g_list_prepend(r, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2630 c++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2631 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2632 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2633
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2634 return r;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2635 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2636
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2637 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2638 unseen_conv_menu_cb(GtkMenuItem *item, GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2639 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2640 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2641 gaim_gtkconv_present_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2642 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2643
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2644 guint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2645 gaim_gtk_conversations_fill_menu(GtkWidget *menu, GList *convs)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2646 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2647 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2648 guint ret=0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2649
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2650 g_return_val_if_fail(menu != NULL, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2651 g_return_val_if_fail(convs != NULL, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2652
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2653 for (l = convs; l != NULL ; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2654 GaimConversation *conv = (GaimConversation*)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2655 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2656
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2657 GtkWidget *icon = gtk_image_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2658 GdkPixbuf *pbuf = gaim_gtkconv_get_tab_icon(conv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2659 GtkWidget *item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2660 gchar *text = g_strdup_printf("%s (%d)",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2661 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2662 gtkconv->unseen_count);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2663
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2664 gtk_image_set_from_pixbuf(GTK_IMAGE(icon), pbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2665 g_object_unref(pbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2666
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2667 item = gtk_image_menu_item_new_with_label(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2668 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2669 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(unseen_conv_menu_cb), conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2670 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2671 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2672 ret++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2673 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2675 return ret;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2676 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2677
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2678 GaimGtkWindow *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2679 gaim_gtkconv_get_window(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2680 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2681 g_return_val_if_fail(gtkconv != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2682 return gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2683 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2684
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2685 static GtkItemFactoryEntry menu_items[] =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2686 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2687 /* Conversation menu */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2688 { N_("/_Conversation"), NULL, NULL, 0, "<Branch>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2689
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2690 { N_("/Conversation/New Instant _Message..."), "<CTL>M", menu_new_conv_cb,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2691 0, "<StockItem>", GAIM_STOCK_IM },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2692
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2693 { "/Conversation/sep0", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2695 { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2696 "<StockItem>", GTK_STOCK_FIND },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2697 { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "<StockItem>", GAIM_STOCK_LOG },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2698 { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2699 "<StockItem>", GTK_STOCK_SAVE_AS },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2700 { N_("/Conversation/Clea_r Scrollback"), "<CTL>L", menu_clear_cb, 0, "<StockItem>", GTK_STOCK_CLEAR },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2701
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2702 { "/Conversation/sep1", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2703
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2704 { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2705 { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2706 0, "<StockItem>", GAIM_STOCK_POUNCE },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2707 { N_("/Conversation/_Get Info"), "<CTL>O", menu_get_info_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2708 "<StockItem>", GAIM_STOCK_INFO },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2709 { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2710 "<StockItem>", GAIM_STOCK_INVITE },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2711 { N_("/Conversation/M_ore"), NULL, NULL, 0, "<Branch>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2712
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2713 { "/Conversation/sep2", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2714
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2715 { N_("/Conversation/Al_ias..."), NULL, menu_alias_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2716 "<StockItem>", GAIM_STOCK_EDIT },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2717 { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2718 "<StockItem>", GAIM_STOCK_BLOCK },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2719 { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2720 "<StockItem>", GTK_STOCK_ADD },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2721 { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2722 "<StockItem>", GTK_STOCK_REMOVE },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2723
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2724 { "/Conversation/sep3", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2725
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2726 { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2727 "<StockItem>", GAIM_STOCK_LINK },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2728 { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2729 "<StockItem>", GAIM_STOCK_IMAGE },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2730
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2731 { "/Conversation/sep4", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2732
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2733 { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2734 "<StockItem>", GTK_STOCK_CLOSE },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2735
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2736 /* Options */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2737 { N_("/_Options"), NULL, NULL, 0, "<Branch>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2738 { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "<CheckItem>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2739 { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2740 { N_("/Options/Show Buddy _Icon"), NULL, menu_buddyicon_cb, 0, "<CheckItem>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2741 { "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2742 { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2743 { N_("/Options/Show Ti_mestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>", NULL },
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2744 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2745
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2746 static const int menu_item_count =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2747 sizeof(menu_items) / sizeof(*menu_items);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2748
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2749 static const char *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2750 item_factory_translate_func (const char *path, gpointer func_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2751 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2752 return _(path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2753 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2754
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2755 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2756 sound_method_pref_changed_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2757 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2758 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2759 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2760 const char *method = value;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2761
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2762 if (!strcmp(method, "none"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2763 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2764 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2765 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2766 gtk_widget_set_sensitive(win->menu.sounds, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2767 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2768 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2769 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2770 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2771
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2772 if (gtkconv != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2773 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2774 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2775 gtk_widget_set_sensitive(win->menu.sounds, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2776
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2777 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2778 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2779
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2780 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2781 show_buddy_icons_pref_changed_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2782 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2783 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2784 GaimGtkWindow *win = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2785 gboolean show_icons = GPOINTER_TO_INT(value);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2786
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2787 if (!show_icons)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2788 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2789 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2790 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2791 gtk_widget_set_sensitive(win->menu.show_icon, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2792 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2793 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2794 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2795 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2796
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2797 if (gtkconv != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2798 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2799 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2800 gtk_widget_set_sensitive(win->menu.show_icon, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2801
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2802 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2803 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2804
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2805 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2806 regenerate_options_items(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2807 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2808 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2809 GList *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2810 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2811 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2812 GaimBuddy *buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2813
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2814 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2815 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2816 buddy = gaim_find_buddy(conv->account, conv->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2817
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2818 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2819
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2820 /* Remove the previous entries */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2821 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; )
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2822 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2823 GtkWidget *w = list->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2824 list = list->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2825 gtk_widget_destroy(w);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2826 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2827
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2828 /* Now add the stuff */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2829 if (buddy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2830 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2831 if (gaim_account_is_connected(conv->account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2832 gaim_gtk_append_blist_node_proto_menu(menu, conv->account->gc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2833 (GaimBlistNode *)buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2834 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2835 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2836
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2837 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2838 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2839 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2840 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2841 gtk_widget_set_sensitive(item, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2842 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2843
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2844 gtk_widget_show_all(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2845 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2846
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2847 static void menubar_activated(GtkWidget *item, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2848 {
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2849 GaimGtkWindow *win = data;
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2850 regenerate_options_items(win);
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2851
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2852 /* The following are to make sure the 'More' submenu is not regenerated every time
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2853 * the focus shifts from 'Conversations' to some other menu and back. */
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2854 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(menubar_activated), data);
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2855 g_signal_connect(G_OBJECT(win->menu.menubar), "deactivate", G_CALLBACK(focus_out_from_menubar), data);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2856 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2857
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2858 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2859 focus_out_from_menubar(GtkWidget *wid, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2860 {
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2861 /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2862 * the 'Conversation' menu pops up. */
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2863 GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2864 g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win);
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2865 g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar),
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2866 G_CALLBACK(focus_out_from_menubar), win);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2867 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2868
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2869 static GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2870 setup_menubar(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2871 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2872 GtkAccelGroup *accel_group;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2873 const char *method;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2874 GtkWidget *menuitem;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2875
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2876 accel_group = gtk_accel_group_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2877 gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2878 g_object_unref(accel_group);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2879
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2880 win->menu.item_factory =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2881 gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2883 gtk_item_factory_set_translate_func(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2884 (GtkTranslateFunc)item_factory_translate_func,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2885 NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2886
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2887 gtk_item_factory_create_items(win->menu.item_factory, menu_item_count,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2888 menu_items, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2889 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2890 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2891
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2892 /* Make sure the 'Conversation -> More' menuitems are regenerated whenever
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2893 * the 'Conversation' menu pops up because the entries can change after the
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
2894 * conversation is created. */
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2895 menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2896 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2897
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2898 win->menu.menubar =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2899 gtk_item_factory_get_widget(win->menu.item_factory, "<main>");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2900
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2901 win->menu.view_log =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2902 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2903 N_("/Conversation/View Log"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2904
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2905 /* --- */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2906
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2907 win->menu.send_file =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2908 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2909 N_("/Conversation/Send File..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2910
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2911 win->menu.add_pounce =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2912 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2913 N_("/Conversation/Add Buddy Pounce..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2914
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2915 /* --- */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2916
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2917 win->menu.get_info =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2918 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2919 N_("/Conversation/Get Info"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2920
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2921 win->menu.invite =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2922 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2923 N_("/Conversation/Invite..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2924
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2925 /* --- */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2926
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2927 win->menu.alias =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2928 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2929 N_("/Conversation/Alias..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2930
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2931 win->menu.block =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2932 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2933 N_("/Conversation/Block..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2934
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2935 win->menu.add =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2936 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2937 N_("/Conversation/Add..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2938
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2939 win->menu.remove =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2940 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2941 N_("/Conversation/Remove..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2943 /* --- */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2944
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2945 win->menu.insert_link =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2946 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2947 N_("/Conversation/Insert Link..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2948
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2949 win->menu.insert_image =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2950 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2951 N_("/Conversation/Insert Image..."));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2952
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2953 /* --- */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2954
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2955 win->menu.logging =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2956 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2957 N_("/Options/Enable Logging"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2958 win->menu.sounds =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2959 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2960 N_("/Options/Enable Sounds"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2961 method = gaim_prefs_get_string("/gaim/gtk/sound/method");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2962 if (!strcmp(method, "none"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2963 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2964 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2965 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2966 gtk_widget_set_sensitive(win->menu.sounds, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2967 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2968 gaim_prefs_connect_callback(win, "/gaim/gtk/sound/method",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2969 sound_method_pref_changed_cb, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2970
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2971 win->menu.show_formatting_toolbar =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2972 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2973 N_("/Options/Show Formatting Toolbars"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2974 win->menu.show_timestamps =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2975 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2976 N_("/Options/Show Timestamps"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2977 win->menu.show_icon =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2978 gtk_item_factory_get_widget(win->menu.item_factory,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2979 N_("/Options/Show Buddy Icon"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2980 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2981 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2982 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2983 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2984 gtk_widget_set_sensitive(win->menu.show_icon, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2985 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2986 gaim_prefs_connect_callback(win, "/gaim/gtk/conversations/im/show_buddy_icons",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2987 show_buddy_icons_pref_changed_cb, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2988
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2989 win->menu.tray = gaim_gtk_menu_tray_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2990 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2991 win->menu.tray);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2992 gtk_widget_show(win->menu.tray);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2993
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2994 gtk_widget_show(win->menu.menubar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2995
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2996 return win->menu.menubar;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2997 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2998
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2999
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3000 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3001 * Utility functions
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3002 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3003
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3004 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3005 got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3006 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3007 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3008 GaimConvIm *im;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3009
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3010 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3011 * We know we got something, so we at least have to make sure we don't
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3012 * send GAIM_TYPED any time soon.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3013 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3014
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3015 im = GAIM_CONV_IM(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3016
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3017 gaim_conv_im_stop_send_typed_timeout(im);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3018 gaim_conv_im_start_send_typed_timeout(im);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3019
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3020 /* Check if we need to send another GAIM_TYPING message */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3021 if (first || (gaim_conv_im_get_type_again(im) != 0 &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3022 time(NULL) > gaim_conv_im_get_type_again(im)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3023 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3024 unsigned int timeout;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3025 timeout = serv_send_typing(gaim_conversation_get_gc(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3026 gaim_conversation_get_name(conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3027 GAIM_TYPING);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3028 gaim_conv_im_set_type_again(im, timeout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3029 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3030 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3031
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3032 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3033 update_typing_icon(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3034 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3035 GaimGtkWindow *gtkwin;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3036 GaimConvIm *im = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3037 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3038 char *stock_id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3039 const char *tooltip;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3040
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3041 gtkwin = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3042
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3043 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3044 im = GAIM_CONV_IM(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3045
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3046 if (gtkwin->menu.typing_icon) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3047 gtk_widget_hide(gtkwin->menu.typing_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3048 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3049
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3050 if (!im || (gaim_conv_im_get_typing_state(im) == GAIM_NOT_TYPING))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3051 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3053 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3054 stock_id = GAIM_STOCK_TYPING;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3055 tooltip = _("User is typing...");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3056 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3057 stock_id = GAIM_STOCK_TYPED;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3058 tooltip = _("User has typed something and stopped");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3059 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3060
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3061 if (gtkwin->menu.typing_icon == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3062 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3063 gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3064 gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3065 gtkwin->menu.typing_icon,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3066 tooltip);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3067 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3068 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3069 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3070 gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3071 gaim_gtk_menu_tray_set_tooltip(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3072 gtkwin->menu.typing_icon,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3073 tooltip);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3074 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3075
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3076 gtk_widget_show(gtkwin->menu.typing_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3077 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3078
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3079 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3080 update_send_to_selection(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3081 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3082 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3083 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3084 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3085 GList *child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3086 GaimBuddy *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3087
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3088 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3089
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3090 if (conv == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3091 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3092
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3093 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3094
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3095 if (account == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3096 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3097
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3098 if (win->menu.send_to == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3099 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3100
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3101 if (!(b = gaim_find_buddy(account, conv->name)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3102 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3104
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3105 gtk_widget_show(win->menu.send_to);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3106
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3107 menu = gtk_menu_item_get_submenu(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3108 GTK_MENU_ITEM(win->menu.send_to));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3109
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3110 for (child = gtk_container_get_children(GTK_CONTAINER(menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3111 child != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3112 child = child->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3113
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3114 GtkWidget *item = child->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3115 GaimBuddy *item_buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3116 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), "gaim_account");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3117 gchar *buddy_name = g_object_get_data(G_OBJECT(item),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3118 "gaim_buddy_name");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3119 item_buddy = gaim_find_buddy(item_account, buddy_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3120
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3121 if (b == item_buddy) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3122 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3123 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3124 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3125 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3126
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3127 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3128 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3129
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3130 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3131 send_to_item_enter_notify_cb(GtkWidget *menuitem, GdkEventCrossing *event, GtkWidget *label)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3132 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3133 gtk_widget_set_sensitive(GTK_WIDGET(label), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3134 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3135 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3136
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3137 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3138 send_to_item_leave_notify_cb(GtkWidget *menuitem, GdkEventCrossing *event, GtkWidget *label)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3139 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3140 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3141 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3142 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3143
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3144 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3145 create_sendto_item(GtkWidget *menu, GtkSizeGroup *sg, GSList **group, GaimBuddy *buddy, GaimAccount *account, const char *name)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3146 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3147 GtkWidget *box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3148 GtkWidget *label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3149 GtkWidget *image;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3150 GtkWidget *menuitem;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3151 GdkPixbuf *pixbuf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3152 gchar *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3153
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3154 /* Create a pixmap for the protocol icon. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3155 if (buddy != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3156 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3157 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3158 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3159
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3160 /* Now convert it to GtkImage */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3161 if (pixbuf == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3162 image = gtk_image_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3163 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3164 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3165 image = gtk_image_new_from_pixbuf(pixbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3166 g_object_unref(G_OBJECT(pixbuf));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3167 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3168
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3169 gtk_size_group_add_widget(sg, image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3170
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3171 /* Make our menu item */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3172 text = g_strdup_printf("%s (%s)", name, gaim_account_get_username(account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3173 menuitem = gtk_radio_menu_item_new_with_label(*group, text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3174 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3175 *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3176
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3177 /* Do some evil, see some evil, speak some evil. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3178 box = gtk_hbox_new(FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3179
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3180 label = gtk_bin_get_child(GTK_BIN(menuitem));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3181 g_object_ref(label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3182 gtk_container_remove(GTK_CONTAINER(menuitem), label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3183
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3184 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3185 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3187 if (buddy != NULL &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3188 !gaim_presence_is_online(gaim_buddy_get_presence(buddy)) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3189 !gaim_account_supports_offline_message(account, buddy))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3190 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3191 gtk_widget_set_sensitive(label, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3192
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3193 /* Set the label sensitive when the menuitem is highlighted and
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3194 * insensitive again when the mouse leaves it. This way, it
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3195 * doesn't appear weird from the highlighting of the embossed
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3196 * (insensitive style) text.*/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3197 g_signal_connect(menuitem, "enter-notify-event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3198 G_CALLBACK(send_to_item_enter_notify_cb), label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3199 g_signal_connect(menuitem, "leave-notify-event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3200 G_CALLBACK(send_to_item_leave_notify_cb), label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3201 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3202
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3203 g_object_unref(label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3205 gtk_container_add(GTK_CONTAINER(menuitem), box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3206
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3207 gtk_widget_show(label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3208 gtk_widget_show(image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3209 gtk_widget_show(box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3210
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3211 /* Set our data and callbacks. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3212 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3213 g_object_set_data_full(G_OBJECT(menuitem), "gaim_buddy_name", g_strdup(name), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3215 g_signal_connect(G_OBJECT(menuitem), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3216 G_CALLBACK(menu_conv_sel_send_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3217
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3218 gtk_widget_show(menuitem);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3219 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3220 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3221
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3222 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3223 generate_send_to_items(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3224 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3225 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3226 GSList *group = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3227 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3228 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3229 GSList *l, *buds;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3230
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3231 g_return_if_fail(win != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3232
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3233 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3234
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3235 g_return_if_fail(gtkconv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3236
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3237 if (win->menu.send_to != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3238 gtk_widget_destroy(win->menu.send_to);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3240 /* Build the Send To menu */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3241 win->menu.send_to = gtk_menu_item_new_with_mnemonic(_("_Send To"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3242 gtk_widget_show(win->menu.send_to);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3243
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3244 menu = gtk_menu_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3245 gtk_menu_shell_insert(GTK_MENU_SHELL(win->menu.menubar),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3246 win->menu.send_to, 2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3247 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3248
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3249 gtk_widget_show(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3250
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3251 if (gtkconv->active_conv->type == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3252 buds = gaim_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3254 if (buds == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3255 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3256 /* The user isn't on the buddy list. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3257 create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3258 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3259 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3260 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3261 GList *list = NULL, *iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3262 for (l = buds; l != NULL; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3263 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3264 GaimBlistNode *node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3265
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3266 node = (GaimBlistNode *) gaim_buddy_get_contact((GaimBuddy *)l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3267
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3268 for (node = node->child; node != NULL; node = node->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3269 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3270 GaimBuddy *buddy = (GaimBuddy *)node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3271 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3272
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3273 if (!GAIM_BLIST_NODE_IS_BUDDY(node))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3274 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3275
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3276 account = gaim_buddy_get_account(buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3277 if (gaim_account_is_connected(account))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3278 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3279 /* Use the GaimPresence to get unique buddies. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3280 GaimPresence *presence = gaim_buddy_get_presence(buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3281 if (!g_list_find(list, presence))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3282 list = g_list_prepend(list, presence);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3283 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3284 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3285 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3286
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3287 /* Loop over the list backwards so we get the items in the right order,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3288 * since we did a g_list_prepend() earlier. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3289 for (iter = g_list_last(list); iter != NULL; iter = iter->prev)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3290 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3291 GaimPresence *pre = iter->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3292 GaimBuddy *buddy = gaim_presence_get_buddies(pre)->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3293 create_sendto_item(menu, sg, &group, buddy,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3294 gaim_buddy_get_account(buddy), gaim_buddy_get_name(buddy));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3295 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3296 g_list_free(list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3297 g_slist_free(buds);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3298 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3299 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3300
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3301 g_object_unref(sg);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3302
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3303 gtk_widget_show(win->menu.send_to);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3304 /* TODO: This should never be insensitive. Possibly hidden or not. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3305 if (!group)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3306 gtk_widget_set_sensitive(win->menu.send_to, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3307 update_send_to_selection(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3308 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3309
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3310 static GList *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3311 generate_invite_user_names(GaimConnection *gc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3312 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3313 GaimBlistNode *gnode,*cnode,*bnode;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3314 static GList *tmp = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3315
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3316 g_list_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3317
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3318 tmp = g_list_append(NULL, "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3319
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3320 if (gc != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3321 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3322 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3323 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3324 for(cnode = gnode->child; cnode; cnode = cnode->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3325 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3326 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3327 for(bnode = cnode->child; bnode; bnode = bnode->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3328 GaimBuddy *buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3330 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3331 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3332
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3333 buddy = (GaimBuddy *)bnode;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3334
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3335 if (buddy->account == gc->account &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3336 GAIM_BUDDY_IS_ONLINE(buddy))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3337 tmp = g_list_insert_sorted(tmp, buddy->name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3338 (GCompareFunc)g_utf8_collate);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3339 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3340 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3341 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3342 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3343
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3344 return tmp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3345 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3346
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3347 static GdkPixbuf *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3348 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3349 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3350 GdkPixbuf *pixbuf, *scale, *scale2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3351 char *filename;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3352 const char *image = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3353
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3354 if (flags & GAIM_CBFLAGS_FOUNDER) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3355 image = "founder.png";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3356 } else if (flags & GAIM_CBFLAGS_OP) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3357 image = "op.png";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3358 } else if (flags & GAIM_CBFLAGS_HALFOP) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3359 image = "halfop.png";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3360 } else if (flags & GAIM_CBFLAGS_VOICE) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3361 image = "voice.png";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3362 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3363 image = "ignored.png";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3364 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3365 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3366 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3367
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3368 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3369 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3370 g_free(filename);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3372 if (!pixbuf)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3373 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3375 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3376 g_object_unref(pixbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3377
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3378 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3379 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3380 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3381 g_free(filename);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3382 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3383 g_object_unref(pixbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3384 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3385 g_object_unref(scale2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3386 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3387
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3388 return scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3389 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3390
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3391 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3392 add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3393 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3394 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3395 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3396 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3397 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3398 GaimPluginProtocolInfo *prpl_info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3399 GtkListStore *ls;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3400 GdkPixbuf *pixbuf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3401 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3402 gboolean is_me = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3403 gboolean is_buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3404 gchar *alias_key, *name, *alias;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3405 int flags;
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
3406
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3407 alias = cb->alias;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3408 name = cb->name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3409 flags = GPOINTER_TO_INT(cb->flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3410
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3411 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3412 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3413 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3414 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3416 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3417 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3418
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3419 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3420
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3421 pixbuf = get_chat_buddy_status_icon(chat, name, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3422
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3423 if (!strcmp(chat->nick, gaim_normalize(conv->account, old_name != NULL ? old_name : name)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3424 is_me = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3425
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3426 is_buddy = (gaim_find_buddy(conv->account, name) != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3427
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3428 alias_key = g_utf8_collate_key(alias, strlen(alias));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3429
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3430 if (is_me)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3431 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3432 GdkColor send_color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3433 gdk_color_parse(SEND_COLOR, &send_color);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
3434
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
3435 #if GTK_CHECK_VERSION(2,6,0)
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3436 gtk_list_store_insert_with_values(ls, &iter,
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
3437 /*
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3438 * The GTK docs are mute about the effects of the "row" value for performance.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3439 * X-Chat hardcodes their value to 0 (prepend) and -1 (append), so we will too.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3440 * It *might* be faster to search the gtk_list_store and set row accurately,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3441 * but no one in #gtk+ seems to know anything about it either.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3442 * Inserting in the "wrong" location has no visible ill effects. - F.P.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3443 */
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3444 -1, /* "row" */
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3445 CHAT_USERS_ICON_COLUMN, pixbuf,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3446 CHAT_USERS_ALIAS_COLUMN, alias,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3447 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3448 CHAT_USERS_NAME_COLUMN, name,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3449 CHAT_USERS_FLAGS_COLUMN, flags,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3450 CHAT_USERS_COLOR_COLUMN, &send_color,
14584
1f7581a5d2b8 [gaim-migrate @ 17308]
Richard Laager <rlaager@wiktel.com>
parents: 14583
diff changeset
3451 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3452 -1);
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3453 }
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3454 else
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3455 {
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3456 gtk_list_store_insert_with_values(ls, &iter,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3457 -1, /* "row" */
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3458 CHAT_USERS_ICON_COLUMN, pixbuf,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3459 CHAT_USERS_ALIAS_COLUMN, alias,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3460 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3461 CHAT_USERS_NAME_COLUMN, name,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3462 CHAT_USERS_FLAGS_COLUMN, flags,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3463 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3464 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3465 -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3466 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3467 gtk_list_store_append(ls, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3468 gtk_list_store_set(ls, &iter,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3469 CHAT_USERS_ICON_COLUMN, pixbuf,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3470 CHAT_USERS_ALIAS_COLUMN, alias,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3471 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3472 CHAT_USERS_NAME_COLUMN, name,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3473 CHAT_USERS_FLAGS_COLUMN, flags,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3474 CHAT_USERS_COLOR_COLUMN, &send_color,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3475 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3476 -1);
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3477 }
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3478 else
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3479 {
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3480 gtk_list_store_append(ls, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3481 gtk_list_store_set(ls, &iter,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3482 CHAT_USERS_ICON_COLUMN, pixbuf,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3483 CHAT_USERS_ALIAS_COLUMN, alias,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3484 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3485 CHAT_USERS_NAME_COLUMN, name,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3486 CHAT_USERS_FLAGS_COLUMN, flags,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3487 CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name),
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3488 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3489 -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3490 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3491 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3492
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3493 if (pixbuf)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3494 g_object_unref(pixbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3495 g_free(alias_key);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3496 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3497
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3498 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3499 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3500 GList **matches, gboolean command, char *name)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3501 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3502 strncpy(nick_partial, name, strlen(entered));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3503 nick_partial[strlen(entered)] = '\0';
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3504 if (gaim_utf8_strcasecmp(nick_partial, entered))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3505 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3507 /* if we're here, it's a possible completion */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3508
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3509 if (*most_matched == -1) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3510 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3511 * this will only get called once, since from now
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3512 * on *most_matched is >= 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3513 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3514 *most_matched = strlen(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3515 *partial = g_strdup(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3516 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3517 else if (*most_matched) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3518 char *tmp = g_strdup(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3519
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3520 while (gaim_utf8_strcasecmp(tmp, *partial)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3521 (*partial)[*most_matched] = '\0';
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3522 if (*most_matched < strlen(tmp))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3523 tmp[*most_matched] = '\0';
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3524 (*most_matched)--;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3525 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3526 (*most_matched)++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3527
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3528 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3529 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3530
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3531 *matches = g_list_insert_sorted(*matches, g_strdup(name),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3532 (GCompareFunc)gaim_utf8_strcasecmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3533 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3534
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3535 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3536 tab_complete(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3537 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3538 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3539 GtkTextIter cursor, word_start, start_buffer;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3540 int start;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3541 int most_matched = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3542 char *entered, *partial = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3543 char *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3544 char *nick_partial;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3545 const char *prefix;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3546 GList *matches = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3547 gboolean command = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3548
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3549 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3550
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3551 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3552 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3553 gtk_text_buffer_get_insert(gtkconv->entry_buffer));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3555 word_start = cursor;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3556
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3557 /* if there's nothing there just return */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3558 if (!gtk_text_iter_compare(&cursor, &start_buffer))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3559 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3561 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3562 &cursor, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3563
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3564 /* if we're at the end of ": " we need to move back 2 spaces */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3565 start = strlen(text) - 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3566
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3567 if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3568 gtk_text_iter_backward_chars(&word_start, 2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3569 start-=2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3570 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3571
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3572 /* find the start of the word that we're tabbing */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3573 while (start >= 0 && text[start] != ' ') {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3574 gtk_text_iter_backward_char(&word_start);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3575 start--;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3576 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3577
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3578 prefix = gaim_gtk_get_cmd_prefix();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3579 if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3580 command = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3581 gtk_text_iter_forward_chars(&word_start, strlen(prefix));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3582 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3583
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3584 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3585
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3586 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3587 &cursor, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3588
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3589 if (!g_utf8_strlen(entered, -1)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3590 g_free(entered);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3591 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3592 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3593
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3594 nick_partial = g_malloc(strlen(entered)+1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3595
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3596 if (command) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3597 GList *list = gaim_cmd_list(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3598 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3599
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3600 /* Commands */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3601 for (l = list; l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3602 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3603 &matches, TRUE, l->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3604 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3605 g_list_free(list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3606 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3607 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3608 GList *l = gaim_conv_chat_get_users(chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3609 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3610 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3611 int f;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3613 /* Users */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3614 for (; l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3615 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3616 &matches, TRUE, ((GaimConvChatBuddy *)l->data)->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3617 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3618
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3619
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3620 /* Aliases */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3621 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3622 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3623 do {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3624 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3625 char *alias;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3626
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3627 gtk_tree_model_get(model, &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3628 CHAT_USERS_NAME_COLUMN, &name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3629 CHAT_USERS_ALIAS_COLUMN, &alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3630 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3631
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3632 if (strcmp(name, alias))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3633 tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3634 &matches, FALSE, alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3635 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3636 g_free(alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3637
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3638 f = gtk_tree_model_iter_next(model, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3639 } while (f != 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3640 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3641 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3642 g_free(nick_partial);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3643 g_free(entered);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3644 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3645 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3647 g_free(nick_partial);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3648
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3649 /* we're only here if we're doing new style */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3650
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3651 /* if there weren't any matches, return */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3652 if (!matches) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3653 /* if matches isn't set partials won't be either */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3654 g_free(entered);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3655 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3656 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3657
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3658 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3659
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3660 if (!matches->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3661 /* there was only one match. fill it in. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3662 gtk_text_buffer_get_start_iter(gtkconv->entry_buffer, &start_buffer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3663 gtk_text_buffer_get_iter_at_mark(gtkconv->entry_buffer, &cursor,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3664 gtk_text_buffer_get_insert(gtkconv->entry_buffer));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3665
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3666 if (!gtk_text_iter_compare(&cursor, &start_buffer)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3667 char *tmp = g_strdup_printf("%s: ", (char *)matches->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3668 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, tmp, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3669 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3670 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3671 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3672 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3673 matches->data, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3675 g_free(matches->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3676 matches = g_list_remove(matches, matches->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3677 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3678 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3679 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3680 * there were lots of matches, fill in as much as possible
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3681 * and display all of them
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3682 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3683 char *addthis = g_malloc0(1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3684
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3685 while (matches) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3686 char *tmp = addthis;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3687 addthis = g_strconcat(tmp, matches->data, " ", NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3688 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3689 g_free(matches->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3690 matches = g_list_remove(matches, matches->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3691 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3692
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3693 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3694 time(NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3695 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3696 g_free(addthis);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3697 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3698
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3699 g_free(entered);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3700 g_free(partial);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3701
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3702 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3703 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3704
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3705 static void topic_callback(GtkWidget *w, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3706 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3707 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3708 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3709 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3710 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3711 char *new_topic;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3712 const char *current_topic;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3713
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3714 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3715
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3716 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3717 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3718
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3719 if(prpl_info->set_chat_topic == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3720 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3721
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3722 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3723 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3724 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3725 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3727 if(current_topic && !g_utf8_collate(new_topic, current_topic)){
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3728 g_free(new_topic);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3729 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3730 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3731
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3732 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3733
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3734 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3735 new_topic);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3736
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3737 g_free(new_topic);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3738 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3739
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3740 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3741 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3742 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3743 GaimConvChatBuddyFlags f1 = 0, f2 = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3744 char *user1 = NULL, *user2 = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3745 gboolean buddy1 = FALSE, buddy2 = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3746 gint ret = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3747
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3748 gtk_tree_model_get(model, a,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3749 CHAT_USERS_ALIAS_KEY_COLUMN, &user1,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3750 CHAT_USERS_FLAGS_COLUMN, &f1,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3751 CHAT_USERS_WEIGHT_COLUMN, &buddy1,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3752 -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3753 gtk_tree_model_get(model, b,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3754 CHAT_USERS_ALIAS_KEY_COLUMN, &user2,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3755 CHAT_USERS_FLAGS_COLUMN, &f2,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3756 CHAT_USERS_WEIGHT_COLUMN, &buddy2,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3757 -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3758
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3759 if (user1 == NULL || user2 == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3760 if (!(user1 == NULL && user2 == NULL))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3761 ret = (user1 == NULL) ? -1: 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3762 } else if (f1 != f2) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3763 /* sort more important users first */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3764 ret = (f1 > f2) ? -1 : 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3765 } else if (buddy1 != buddy2) {
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3766 ret = (buddy1 > buddy2) ? -1 : 1;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3767 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3768 ret = strcasecmp(user1, user2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3769 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3770
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3771 g_free(user1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3772 g_free(user2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3773
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3774 return ret;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3775 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3776
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3777 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3778 update_chat_alias(GaimBuddy *buddy, GaimConversation *conv, GaimConnection *gc, GaimPluginProtocolInfo *prpl_info)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3779 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3780 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3781 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3782 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3783 char *normalized_name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3784 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3785 int f;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3786
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3787 g_return_if_fail(buddy != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3788 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3789
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3790 /* This is safe because this callback is only used in chats, not IMs. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3791 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3792
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3793 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3794 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3795
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3796 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3797
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3798 do {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3799 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3800
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3801 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3802
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3803 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3804 const char *alias = name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3805 char *alias_key = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3806 GaimBuddy *buddy2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3807
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3808 if (strcmp(chat->nick, gaim_normalize(conv->account, name))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3809 /* This user is not me, so look into updating the alias. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3810
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3811 if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3812 alias = gaim_buddy_get_contact_alias(buddy2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3813 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3814
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3815 alias_key = g_utf8_collate_key(alias, strlen(alias));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3817 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3818 CHAT_USERS_ALIAS_COLUMN, alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3819 CHAT_USERS_ALIAS_KEY_COLUMN, alias_key,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3820 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3821 g_free(alias_key);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3822 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3823 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3824 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3825 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3826
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3827 f = gtk_tree_model_iter_next(model, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3828
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3829 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3830 } while (f != 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3831
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3832 g_free(normalized_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3833 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3834
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3835 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3836 blist_node_aliased_cb(GaimBlistNode *node, const char *old_alias, GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3837 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3838 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3839 GaimPluginProtocolInfo *prpl_info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3840
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3841 g_return_if_fail(node != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3842 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3843
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3844 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3845 g_return_if_fail(gc != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3846 g_return_if_fail(gc->prpl != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3847 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3848
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3849 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3850 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3851
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3852 if (GAIM_BLIST_NODE_IS_CONTACT(node))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3853 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3854 GaimBlistNode *bnode;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3855
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3856 for(bnode = node->child; bnode; bnode = bnode->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3857
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3858 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3859 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3860
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3861 update_chat_alias((GaimBuddy *)bnode, conv, gc, prpl_info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3862 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3863 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3864 else if (GAIM_BLIST_NODE_IS_BUDDY(node))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3865 update_chat_alias((GaimBuddy *)node, conv, gc, prpl_info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3866 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3867
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3868 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3869 buddy_cb_common(GaimBuddy *buddy, GaimConversation *conv, gboolean is_buddy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3870 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3871 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3872 char *normalized_name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3873 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3874 int f;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3875
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3876 g_return_if_fail(buddy != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3877 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3878
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3879 /* Do nothing if the buddy does not belong to the conv's account */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3880 if (gaim_buddy_get_account(buddy) != gaim_conversation_get_account(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3881 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3883 /* This is safe because this callback is only used in chats, not IMs. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3884 model = gtk_tree_view_get_model(GTK_TREE_VIEW(GAIM_GTK_CONVERSATION(conv)->u.chat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3885
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3886 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3887 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3888
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3889 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3890
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3891 do {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3892 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3893
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3894 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3895
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3896 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) {
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3897 gtk_list_store_set(GTK_LIST_STORE(model), &iter,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
3898 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3899 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3900 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3901 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3902
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3903 f = gtk_tree_model_iter_next(model, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3904
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3905 g_free(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3906 } while (f != 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3907
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3908 g_free(normalized_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3909
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3910 blist_node_aliased_cb((GaimBlistNode *)buddy, NULL, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3911 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3912
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3913 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3914 buddy_added_cb(GaimBuddy *buddy, GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3915 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3916 buddy_cb_common(buddy, conv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3917 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3918
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3919 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3920 buddy_removed_cb(GaimBuddy *buddy, GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3921 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3922 /* If there's another buddy for the same "dude" on the list, do nothing. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3923 if (gaim_find_buddy(buddy->account, buddy->name) != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3924 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3925
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3926 buddy_cb_common(buddy, conv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3927 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3928
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3929 static void send_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3930 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3931 g_signal_emit_by_name(gtkconv->entry, "message_send");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3932 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3933
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3934 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3935 entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3936 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3937 GtkWidget *menuitem;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3938 GaimGtkConversation *gtkconv = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3939
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3940 g_return_if_fail(menu != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3941 g_return_if_fail(gtkconv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3943 menuitem = gaim_new_item_from_stock(NULL, _("_Send"), GAIM_STOCK_SEND,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3944 G_CALLBACK(send_menu_cb), gtkconv,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3945 0, 0, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3946 if (gtk_text_buffer_get_char_count(imhtml->text_buffer) == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3947 gtk_widget_set_sensitive(menuitem, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3948 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3949
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3950 menuitem = gtk_separator_menu_item_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3951 gtk_widget_show(menuitem);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3952 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3953 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3954
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3955 static GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3956 setup_chat_pane(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3957 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3958 GaimPluginProtocolInfo *prpl_info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3959 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3960 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3961 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3962 GtkWidget *vpaned, *hpaned;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3963 GtkWidget *vbox, *hbox, *frame;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3964 GtkWidget *imhtml_sw;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3965 GtkPolicyType imhtml_sw_hscroll;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3966 GtkWidget *lbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3967 GtkWidget *label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3968 GtkWidget *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3969 GtkWidget *sw;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3970 GtkListStore *ls;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3971 GtkCellRenderer *rend;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3972 GtkTreeViewColumn *col;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3973 void *blist_handle = gaim_blist_get_handle();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3974 GList *focus_chain = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3975
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3976 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3977 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3978 g_return_val_if_fail(gc != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3979 g_return_val_if_fail(gc->prpl != NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3980 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3981
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3982 /* Setup the outer pane. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3983 vpaned = gtk_vpaned_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3984 gtk_widget_show(vpaned);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3985
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3986 /* Setup the top part of the pane. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3987 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3988 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3989 gtk_widget_show(vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3990
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3991 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3992 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3993 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3994 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3995 gtk_widget_show(hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3996
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3997 label = gtk_label_new(_("Topic:"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3998 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3999 gtk_widget_show(label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4000
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4001 gtkchat->topic_text = gtk_entry_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4002
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4003 if(prpl_info->set_chat_topic == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4004 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4005 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4006 g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4007 G_CALLBACK(topic_callback), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4008 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4009
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4010 gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4011 gtk_widget_show(gtkchat->topic_text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4012 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4013
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4014 /* Setup the horizontal pane. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4015 hpaned = gtk_hpaned_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4016 gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4017 gtk_widget_show(hpaned);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4018
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4019 /* Setup gtkihmtml. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4020 frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4021 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4022 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4023 gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4024 gtk_widget_show(frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4025 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4026 &imhtml_sw_hscroll, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4027 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4028 imhtml_sw_hscroll, GTK_POLICY_ALWAYS);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4029
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4030 gtk_widget_set_size_request(gtkconv->imhtml,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4031 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4032 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4033 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4034 G_CALLBACK(size_allocate_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4035
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4036 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4037 G_CALLBACK(entry_stop_rclick_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4038 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4039 G_CALLBACK(refocus_entry_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4040 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4041 G_CALLBACK(refocus_entry_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4042
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4043 /* Build the right pane. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4044 lbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4045 gtk_paned_pack2(GTK_PANED(hpaned), lbox, FALSE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4046 gtk_widget_show(lbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4047
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4048 /* Setup the label telling how many people are in the room. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4049 gtkchat->count = gtk_label_new(_("0 people in room"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4050 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4051 gtk_widget_show(gtkchat->count);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4053 /* Setup the list of users. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4054 sw = gtk_scrolled_window_new(NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4055 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4056 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4057 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4058 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4059 gtk_widget_show(sw);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4060
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4061 ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
4062 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4063 GDK_TYPE_COLOR, G_TYPE_INT);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4064 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4065 sort_chat_users, NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4066
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4067 list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4068
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4069 rend = gtk_cell_renderer_pixbuf_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4070
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4071 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4072 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4073 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4074 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
4075 gtk_widget_set_size_request(lbox,
14591
fc99573b0b62 [gaim-migrate @ 17315]
Sean Egan <seanegan@gmail.com>
parents: 14584
diff changeset
4076 gaim_prefs_get_int("/gaim/gtk/conversations/chat/userlist_width"), -1);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4077
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4078 g_signal_connect(G_OBJECT(list), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4079 G_CALLBACK(right_click_chat_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4080 g_signal_connect(G_OBJECT(list), "popup-menu",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4081 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv);
14701
f063e0bc1f20 [gaim-migrate @ 17453]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14700
diff changeset
4082 g_signal_connect(G_OBJECT(lbox), "size-allocate", G_CALLBACK(lbox_size_allocate_cb), gtkconv);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
4083
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
4084
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4085 rend = gtk_cell_renderer_text_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4086
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4087 g_object_set(rend,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4088 "foreground-set", TRUE,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4089 "weight-set", TRUE,
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4090 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4091 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
14583
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4092 "text", CHAT_USERS_ALIAS_COLUMN,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4093 "foreground-gdk", CHAT_USERS_COLOR_COLUMN,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4094 "weight", CHAT_USERS_WEIGHT_COLUMN,
ac6120e2e27c [gaim-migrate @ 17307]
Richard Laager <rlaager@wiktel.com>
parents: 14574
diff changeset
4095 NULL);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4096
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4097 gaim_signal_connect(blist_handle, "buddy-added",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4098 gtkchat, GAIM_CALLBACK(buddy_added_cb), conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4099 gaim_signal_connect(blist_handle, "buddy-removed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4100 gtkchat, GAIM_CALLBACK(buddy_removed_cb), conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4101 gaim_signal_connect(blist_handle, "blist-node-aliased",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4102 gtkchat, GAIM_CALLBACK(blist_node_aliased_cb), conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4104 #if GTK_CHECK_VERSION(2,6,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4105 gtk_tree_view_column_set_expand(col, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4106 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4107 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4108
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4109 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4110
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4111 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4112 gtk_widget_show(list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4113
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4114 gtkchat->list = list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4115
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4116 gtk_container_add(GTK_CONTAINER(sw), list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4117
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4118 /* Setup the bottom half of the conversation window */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4119 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4120 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4121 gtk_widget_show(vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4122
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4123 gtkconv->lower_hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4124 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4125 gtk_widget_show(gtkconv->lower_hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4126
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4127 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4128 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4129 gtk_widget_show(vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4130
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4131 /* Setup the toolbar, entry widget and all signals */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4132 frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4133 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4134 gtk_widget_show(frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4135
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4136 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4137 G_CALLBACK(entry_popup_menu_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4138
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4139 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4140 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4141 gaim_account_get_protocol_name(conv->account));
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
4142 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4143 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4144 gtkconv->entry_buffer =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4145 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4146 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4147
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4148 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4149 G_CALLBACK(entry_key_press_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4150 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4151 G_CALLBACK(send_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4152 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4153 G_CALLBACK(entry_stop_rclick_cb), NULL);
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
4154 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate",
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4155 G_CALLBACK(size_allocate_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4156
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4157 default_formatize(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4158
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4159 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4160 * Focus for chat windows should be as follows:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4161 * Tab title -> chat topic -> conversation scrollback -> user list ->
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4162 * user list buttons -> entry -> buttons at bottom
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4163 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4164 focus_chain = g_list_prepend(focus_chain, gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4165 gtk_container_set_focus_chain(GTK_CONTAINER(vbox), focus_chain);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4166
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4167 return vpaned;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4168 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4169
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4170 static GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4171 setup_im_pane(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4172 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4173 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4174 GtkWidget *frame;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4175 GtkWidget *imhtml_sw;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4176 GtkPolicyType imhtml_sw_hscroll;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4177 GtkWidget *paned;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4178 GtkWidget *vbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4179 GtkWidget *vbox2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4180 GList *focus_chain = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4181
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4182 /* Setup the outer pane */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4183 paned = gtk_vpaned_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4184 gtk_widget_show(paned);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4186 /* Setup the top part of the pane */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4187 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4188 gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4189 gtk_widget_show(vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4190
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4191 /* Setup the gtkimhtml widget */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4192 frame = gaim_gtk_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4193 gtk_widget_set_name(gtkconv->imhtml, "gaim_gtkconv_imhtml");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4194 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4195 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4196 gtk_widget_show(frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4197 gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4198 &imhtml_sw_hscroll, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4199 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4200 imhtml_sw_hscroll, GTK_POLICY_ALWAYS);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4201
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4202 gtk_widget_set_size_request(gtkconv->imhtml,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4203 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4204 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4205 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4206 G_CALLBACK(size_allocate_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4207
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4208 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4209 G_CALLBACK(entry_stop_rclick_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4210 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4211 G_CALLBACK(refocus_entry_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4212 g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4213 G_CALLBACK(refocus_entry_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4215 /* Setup the bottom half of the conversation window */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4216 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4217 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4218 gtk_widget_show(vbox2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4219
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4220 gtkconv->lower_hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4221 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->lower_hbox, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4222 gtk_widget_show(gtkconv->lower_hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4223
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4224 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4225 gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), vbox2, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4226 gtk_widget_show(vbox2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4227
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4228 /* Setup the toolbar, entry widget and all signals */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4229 frame = gaim_gtk_create_imhtml(TRUE, &gtkconv->entry, &gtkconv->toolbar, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4230 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4231 gtk_widget_show(frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4232
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4233 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4234 G_CALLBACK(entry_popup_menu_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4235
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4236 gtk_widget_set_name(gtkconv->entry, "gaim_gtkconv_entry");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4237 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4238 gaim_account_get_protocol_name(conv->account));
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
4239 gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4240 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4241 gtkconv->entry_buffer =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4242 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4243 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4244
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4245 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4246 G_CALLBACK(entry_key_press_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4247 g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4248 G_CALLBACK(send_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4249 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4250 G_CALLBACK(entry_stop_rclick_cb), NULL);
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
4251 g_signal_connect(G_OBJECT(gtkconv->lower_hbox), "size-allocate",
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4252 G_CALLBACK(size_allocate_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4254 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4255 G_CALLBACK(insert_text_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4256 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4257 G_CALLBACK(delete_text_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4258
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4259 /* had to move this after the imtoolbar is attached so that the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4260 * signals get fired to toggle the buttons on the toolbar as well.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4261 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4262 default_formatize(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4263
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4264 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4265 G_CALLBACK(clear_formatting_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4266
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4267 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4268 gtkconv->u.im->show_icon = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4269
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4270 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4271 * Focus for IM windows should be as follows:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4272 * Tab title -> conversation scrollback -> entry
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4273 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4274 focus_chain = g_list_prepend(focus_chain, gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4275 gtk_container_set_focus_chain(GTK_CONTAINER(vbox2), focus_chain);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4276
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4277 return paned;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4278 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4279
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4280 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4281 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4282 GtkSelectionData *sd, guint info, guint t,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4283 GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4284 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4285 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4286 GaimGtkWindow *win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4287 GaimConversation *c;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4288 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4289 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4290 GaimBlistNode *n = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4291 GaimBuddy *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4292 GaimGtkConversation *gtkconv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4293
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4294 n = *(GaimBlistNode **)sd->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4295
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4296 if (GAIM_BLIST_NODE_IS_CONTACT(n))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4297 b = gaim_contact_get_priority_buddy((GaimContact*)n);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4298 else if (GAIM_BLIST_NODE_IS_BUDDY(n))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4299 b = (GaimBuddy*)n;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4300 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4301 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4302
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4303 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4304 * If we already have an open conversation with this buddy, then
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4305 * just move the conv to this window. Otherwise, create a new
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4306 * conv and add it to this window.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4307 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4308 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4309 if (c != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4310 GaimGtkWindow *oldwin;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4311 gtkconv = GAIM_GTK_CONVERSATION(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4312 oldwin = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4313 if (oldwin != win) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4314 gaim_gtk_conv_window_remove_gtkconv(oldwin, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4315 gaim_gtk_conv_window_add_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4316 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4317 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4318 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4319 gtkconv = GAIM_GTK_CONVERSATION(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4320 if (gtkconv->win != win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4321 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4322 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4323 gaim_gtk_conv_window_add_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4324 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4325 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4326
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4327 /* Make this conversation the active conversation */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4328 gaim_gtk_conv_window_switch_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4330 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4331 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4332 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4333 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4334 char *protocol = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4335 char *username = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4336 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4337 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4338
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4339 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4340 &protocol, &username, NULL))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4341 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4342 if (account == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4343 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4344 gaim_notify_error(win, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4345 _("You are not currently signed on with an account that "
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4346 "can add that buddy."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4347 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4348 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4349 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4350 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4351 gtkconv = GAIM_GTK_CONVERSATION(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4352 if (gtkconv->win != win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4353 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4354 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4355 gaim_gtk_conv_window_add_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4356 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4357 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4358 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4359
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4360 g_free(username);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4361 g_free(protocol);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4362
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4363 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4364 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4365 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4366 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4367 gaim_dnd_file_manage(sd, gaim_conversation_get_account(conv), gaim_conversation_get_name(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4368 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4369 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4370 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4371 gtk_drag_finish(dc, FALSE, FALSE, t);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4372 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4373
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4375 static const GtkTargetEntry te[] =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4376 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4377 GTK_IMHTML_DND_TARGETS,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4378 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM},
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4379 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1}
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4380 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4381
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4382 static GaimGtkConversation *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4383 gaim_gtk_conv_find_gtkconv(GaimConversation * conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4384 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4385 GaimBuddy *bud = gaim_find_buddy(conv->account, conv->name), *b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4386 GaimContact *c;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4387 GaimBlistNode *cn;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4388
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4389 if (!bud)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4390 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4391
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4392 if (!(c = gaim_buddy_get_contact(bud)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4393 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4394
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4395 cn = (GaimBlistNode *)c;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4396 for (b = (GaimBuddy *)cn->child; b; b = (GaimBuddy *) ((GaimBlistNode *)b)->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4397 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4398 if ((conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4399 if (conv->ui_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4400 return conv->ui_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4401 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4402 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4403
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4404 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4405 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4406
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4407 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4408 buddy_update_cb(GaimBlistNode *bnode, gpointer null)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4409 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4410 GList *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4411
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4412 g_return_if_fail(bnode);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4413 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4414
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4415 for (list = gaim_gtk_conv_windows_get_list(); list; list = list->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4416 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4417 GaimGtkWindow *win = list->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4418 GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4419
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4420 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4421 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4422
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4423 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_MENU);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4424 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4425 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4426
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4427 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4428 * Conversation UI operations
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4429 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4430 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4431 private_gtkconv_new(GaimConversation *conv, gboolean hidden)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4432 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4433 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4434 GaimConversationType conv_type = gaim_conversation_get_type(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4435 GtkWidget *pane = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4436 GtkWidget *tab_cont;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4437
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4438 if (conv_type == GAIM_CONV_TYPE_IM && (gtkconv = gaim_gtk_conv_find_gtkconv(conv))) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4439 conv->ui_data = gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4440 if (!g_list_find(gtkconv->convs, conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4441 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4442 gaim_gtkconv_switch_active_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4443 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4444 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4445
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4446 gtkconv = g_new0(GaimGtkConversation, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4447 conv->ui_data = gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4448 gtkconv->active_conv = conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4449 gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4450 gtkconv->send_history = g_list_append(NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4451
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4452 /* Setup some initial variables. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4453 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4454 gtkconv->tooltips = gtk_tooltips_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4455 gtkconv->unseen_state = GAIM_UNSEEN_NONE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4456 gtkconv->unseen_count = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4457
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4458 if (conv_type == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4459 gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4460
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4461 pane = setup_im_pane(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4462 } else if (conv_type == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4463 gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4464 pane = setup_chat_pane(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4465 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4466
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4467 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4468 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4469
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4470 if (pane == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4471 if (conv_type == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4472 g_free(gtkconv->u.chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4473 else if (conv_type == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4474 g_free(gtkconv->u.im);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4475
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4476 g_free(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4477 conv->ui_data = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4478 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4479 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4480
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4481 /* Setup drag-and-drop */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4482 gtk_drag_dest_set(pane,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4483 GTK_DEST_DEFAULT_MOTION |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4484 GTK_DEST_DEFAULT_DROP,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4485 te, sizeof(te) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4486 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4487 gtk_drag_dest_set(pane,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4488 GTK_DEST_DEFAULT_MOTION |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4489 GTK_DEST_DEFAULT_DROP,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4490 te, sizeof(te) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4491 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4492 gtk_drag_dest_set(gtkconv->imhtml, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4493 te, sizeof(te) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4494 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4495
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4496 gtk_drag_dest_set(gtkconv->entry, 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4497 te, sizeof(te) / sizeof(GtkTargetEntry),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4498 GDK_ACTION_COPY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4499
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4500 g_signal_connect(G_OBJECT(pane), "drag_data_received",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4501 G_CALLBACK(conv_dnd_recv), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4502 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4503 G_CALLBACK(conv_dnd_recv), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4504 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4505 G_CALLBACK(conv_dnd_recv), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4507 /* Setup the container for the tab. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4508 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4509 g_object_set_data(G_OBJECT(tab_cont), "GaimGtkConversation", gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4510 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4511 gtk_container_add(GTK_CONTAINER(tab_cont), pane);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4512 gtk_widget_show(pane);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4513
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4514 gtkconv->make_sound = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4515
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4516 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4517 gtk_widget_show(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4518 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4519 gtk_widget_hide(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4520
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4521 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4522 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4523 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4524 gaim_account_get_protocol_name(conv->account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4525
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4526 g_signal_connect_swapped(G_OBJECT(pane), "focus",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4527 G_CALLBACK(gtk_widget_grab_focus),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4528 gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4529
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4530 if (hidden)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4531 gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4532 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4533 gaim_gtkconv_placement_place(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4534
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4535 if (nick_colors == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4536 nbr_nick_colors = NUM_NICK_COLORS;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4537 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4538 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4539 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4540
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4541 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4542 gaim_gtkconv_new_hidden(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4543 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4544 private_gtkconv_new(conv, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4545 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4546
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4547 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4548 gaim_gtkconv_new(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4549 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4550 private_gtkconv_new(conv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4551 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4552
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4553 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4554 received_im_msg_cb(GaimAccount *account, char *sender, char *message,
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
4555 GaimConversation *conv, GaimMessageFlags flags)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4556 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4557 GaimConversationUiOps *ui_ops = gaim_gtk_conversations_get_conv_ui_ops();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4558 if (conv != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4559 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4561 /* create hidden conv if hide_new pref is always */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4562 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always") == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4563 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4564 ui_ops->create_conversation = gaim_gtkconv_new_hidden;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4565 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4566 ui_ops->create_conversation = gaim_gtkconv_new;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4567 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4568 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4569
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4570 /* create hidden conv if hide_new pref is away and account is away */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4571 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away") == 0 &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4572 !gaim_status_is_available(gaim_account_get_active_status(account)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4573 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4574 ui_ops->create_conversation = gaim_gtkconv_new_hidden;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4575 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4576 ui_ops->create_conversation = gaim_gtkconv_new;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4577 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4578 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4579 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4580
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4581 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4582 gaim_gtkconv_destroy(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4583 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4584 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4585
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4586 gtkconv->convs = g_list_remove(gtkconv->convs, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4587 /* Don't destroy ourselves until all our convos are gone */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4588 if (gtkconv->convs)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4589 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4590
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4591 gaim_gtk_conv_window_remove_gtkconv(gtkconv->win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4592
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4593 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4594 gaim_request_close_with_handle(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4595 gaim_notify_close_with_handle(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4596
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4597 gtk_widget_destroy(gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4598 g_object_unref(gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4599
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4600 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4601 if (gtkconv->u.im->icon_timer != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4602 g_source_remove(gtkconv->u.im->icon_timer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4603
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4604 if (gtkconv->u.im->anim != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4605 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4606
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4607 g_free(gtkconv->u.im);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4608 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4609 gaim_signals_disconnect_by_handle(gtkconv->u.chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4610 g_free(gtkconv->u.chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4611 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4613 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4614
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4615 gtkconv->send_history = g_list_first(gtkconv->send_history);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4616 g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4617 g_list_free(gtkconv->send_history);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4618
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4619 g_free(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4620 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4621
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4622
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4623 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4624 gaim_gtkconv_write_im(GaimConversation *conv, const char *who,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4625 const char *message, GaimMessageFlags flags,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4626 time_t mtime)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4627 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4628 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4629
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4630 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4631
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4632 if (conv != gtkconv->active_conv &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4633 flags & GAIM_MESSAGE_ACTIVE_ONLY)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4634 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4635 /* Plugins that want these messages suppressed should be
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4636 * calling gaim_conv_im_write(), so they get suppressed here,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4637 * before being written to the log. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4638 gaim_debug_info("gtkconv",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4639 "Suppressing message for an inactive conversation in gaim_gtkconv_write_im()\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4640 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4641 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4642
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4643 gaim_conversation_write(conv, who, message, flags, mtime);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4644 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4645
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4646 /* The callback for an event on a link tag. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4647 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4648 GdkEvent *event, GtkTextIter *arg2, gpointer data) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4649 if (event->type == GDK_BUTTON_PRESS
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4650 || event->type == GDK_2BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4651 GdkEventButton *btn_event = (GdkEventButton*) event;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4652 GaimConversation *conv = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4653 char *buddyname;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4654
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4655 /* strlen("BUDDY ") == 6 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4656 g_return_val_if_fail((tag->name != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4657 && (strlen(tag->name) > 6), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4658
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4659 buddyname = (tag->name) + 6;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4660
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4661 if (btn_event->button == 2
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4662 && event->type == GDK_2BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4663 chat_do_info(GAIM_GTK_CONVERSATION(conv), buddyname);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4665 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4666 } else if (btn_event->button == 3
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4667 && event->type == GDK_BUTTON_PRESS) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4668 GtkTextIter start, end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4669
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4670 /* we shouldn't display the popup
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4671 * if the user has selected something: */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4672 if (!gtk_text_buffer_get_selection_bounds(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4673 gtk_text_iter_get_buffer(arg2),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4674 &start, &end)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4675 GtkWidget *menu = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4676 GaimConnection *gc =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4677 gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4678
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4679
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4680 menu = create_chat_menu(conv, buddyname, gc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4681 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4682 NULL, GTK_WIDGET(imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4683 btn_event->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4684 btn_event->time);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4685
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4686 /* Don't propagate the event any further */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4687 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4688 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4689 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4690 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4691
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4692 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4693 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4695 static GtkTextTag *get_buddy_tag(GaimConversation *conv, const char *who) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4696 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4697 GtkTextTag *buddytag;
14814
eb1684a9a029 [gaim-migrate @ 17580]
Nathan Walp <nwalp@pidgin.im>
parents: 14721
diff changeset
4698 gchar *str;
eb1684a9a029 [gaim-migrate @ 17580]
Nathan Walp <nwalp@pidgin.im>
parents: 14721
diff changeset
4699
eb1684a9a029 [gaim-migrate @ 17580]
Nathan Walp <nwalp@pidgin.im>
parents: 14721
diff changeset
4700 str = g_strdup_printf("BUDDY %s", who);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4701
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4702 buddytag = gtk_text_tag_table_lookup(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4703 gtk_text_buffer_get_tag_table(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4704 GTK_IMHTML(gtkconv->imhtml)->text_buffer), str);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4705
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4706 if (buddytag == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4707 buddytag = gtk_text_buffer_create_tag(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4708 GTK_IMHTML(gtkconv->imhtml)->text_buffer, str, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4709
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4710 g_signal_connect(G_OBJECT(buddytag), "event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4711 G_CALLBACK(buddytag_event), conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4712 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4713
14816
c538d7df38d6 [gaim-migrate @ 17582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14814
diff changeset
4714 g_free(str);
c538d7df38d6 [gaim-migrate @ 17582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14814
diff changeset
4715
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4716 return buddytag;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4717 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4718
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4719 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4720 gaim_gtkconv_write_conv(GaimConversation *conv, const char *name, const char *alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4721 const char *message, GaimMessageFlags flags,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4722 time_t mtime)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4723 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4724 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4725 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4726 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4727 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4728 GaimPluginProtocolInfo *prpl_info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4729 int gtk_font_options = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4730 int gtk_font_options_all = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4731 int max_scrollback_lines;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4732 int line_count;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4733 char buf2[BUF_LONG];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4734 char *mdate;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4735 char color[10];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4736 char *str;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4737 char *with_font_tag;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4738 char *sml_attrib = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4739 size_t length;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4740 GaimConversationType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4741 char *displaying;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4742 gboolean plugin_return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4743
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4744 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4745 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4746 g_return_if_fail(gtkconv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4747
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4748 if (conv != gtkconv->active_conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4749 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4750 if (flags & GAIM_MESSAGE_ACTIVE_ONLY)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4751 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4752 /* Unless this had GAIM_MESSAGE_NO_LOG, this message
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4753 * was logged. Plugin writers: if this isn't what
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4754 * you wanted, call gaim_conv_im_write() instead of
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4755 * gaim_conversation_write(). */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4756 gaim_debug_info("gtkconv",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4757 "Suppressing message for an inactive conversation in gaim_gtkconv_write_conv()\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4758 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4759 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4760
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4761 /* Set the active conversation to the one that just messaged us. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4762 /* TODO: consider not doing this if the account is offline or something */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4763 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4764 gaim_gtkconv_switch_active_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4765 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4766
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4767 type = gaim_conversation_get_type(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4768 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4769 g_return_if_fail(account != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4770 gc = gaim_account_get_connection(account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4771 g_return_if_fail(gc != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4772
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4773 displaying = g_strdup(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4774 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4775 gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ?
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4776 "displaying-im-msg" : "displaying-chat-msg"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4777 account, name, &displaying, conv, flags));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4778 if (plugin_return)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4779 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4780 g_free(displaying);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4781 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4782 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4783 message = displaying;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4784 length = strlen(message) + 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4785
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4786 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4787 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4788
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4789 line_count = gtk_text_buffer_get_line_count(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4790 gtk_text_view_get_buffer(GTK_TEXT_VIEW(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4791 gtkconv->imhtml)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4792
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4793 max_scrollback_lines = gaim_prefs_get_int(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4794 "/gaim/gtk/conversations/scrollback_lines");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4795 /* If we're sitting at more than 100 lines more than the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4796 max scrollback, trim down to max scrollback */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4797 if (max_scrollback_lines > 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4798 && line_count > (max_scrollback_lines + 100)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4799 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4800 GTK_TEXT_VIEW(gtkconv->imhtml));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4801 GtkTextIter start, end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4802
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4803 gtk_text_buffer_get_start_iter(text_buffer, &start);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4804 gtk_text_buffer_get_iter_at_line(text_buffer, &end,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4805 (line_count - max_scrollback_lines));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4806 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4807 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4808
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4809 if (type == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4810 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4811 /* Create anchor for user */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4812 GtkTextIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4813 char *tmp = g_strconcat("user:", name, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4814
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4815 gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4816 gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4817 tmp, &iter, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4818 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4819 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4820
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4821 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_smooth_scrolling"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4822 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4823
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4824 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml))))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4825 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4826
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4827 mdate = gaim_signal_emit_return_1(gaim_gtk_conversations_get_handle(),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4828 "conversation-timestamp",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4829 conv, mtime);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4830 if (mdate == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4831 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4832 struct tm *tm = localtime(&mtime);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4833 if (time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4834 mdate = g_strdup(gaim_date_format_long(tm));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4835 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4836 mdate = g_strdup(gaim_time_format(tm));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4837 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4838
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4839 sml_attrib = g_strdup_printf("sml=\"%s\"", gaim_account_get_protocol_name(account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4840
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4841 gtk_font_options |= GTK_IMHTML_NO_COMMENTS;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4842
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4843 if ((flags & GAIM_MESSAGE_RECV) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4844 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_incoming_formatting"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4845 gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4846
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4847 /* this is gonna crash one day, I can feel it. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4848 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options &
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4849 OPT_PROTO_USE_POINTSIZE) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4850 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4851 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4852
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4853
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4854 /* TODO: These colors should not be hardcoded so log.c can use them */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4855 if (flags & GAIM_MESSAGE_SYSTEM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4856 g_snprintf(buf2, sizeof(buf2),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4857 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4858 sml_attrib ? sml_attrib : "", mdate, message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4859
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4860 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4861
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4862 } else if (flags & GAIM_MESSAGE_ERROR) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4863 g_snprintf(buf2, sizeof(buf2),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4864 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4865 sml_attrib ? sml_attrib : "", mdate, message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4866
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4867 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4868
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4869 } else if (flags & GAIM_MESSAGE_NO_LOG) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4870 g_snprintf(buf2, BUF_LONG,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4871 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4872 sml_attrib ? sml_attrib : "", message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4873
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4874 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4875 } else if (flags & GAIM_MESSAGE_RAW) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4876 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4877 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4878 char *new_message = g_memdup(message, length);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4879 char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup(""));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4880 /* The initial offset is to deal with
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4881 * escaped entities making the string longer */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4882 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4883 int tag_end_offset = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4884 GtkSmileyTree *tree = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4885 GHashTable *smiley_data = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4886
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4887 if (flags & GAIM_MESSAGE_SEND)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4888 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4889 /* Temporarily revert to the original smiley-data to avoid showing up
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4890 * custom smileys of the buddy when sending message
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4891 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4892 tree = GTK_IMHTML(gtkconv->imhtml)->default_smilies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4893 GTK_IMHTML(gtkconv->imhtml)->default_smilies =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4894 GTK_IMHTML(gtkconv->entry)->default_smilies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4895 smiley_data = GTK_IMHTML(gtkconv->imhtml)->smiley_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4896 GTK_IMHTML(gtkconv->imhtml)->smiley_data = GTK_IMHTML(gtkconv->entry)->smiley_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4897 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4898
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4899 if (flags & GAIM_MESSAGE_WHISPER) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4900 str = g_malloc(1024);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4901
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4902 /* If we're whispering, it's not an autoresponse. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4903 if (gaim_message_meify(new_message, -1 )) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4904 g_snprintf(str, 1024, "***%s", alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4905 strcpy(color, "#6C2585");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4906 tag_start_offset += 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4907 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4908 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4909 g_snprintf(str, 1024, "*%s*:", alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4910 tag_start_offset += 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4911 tag_end_offset = 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4912 strcpy(color, "#00FF00");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4913 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4914 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4915 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4916 if (gaim_message_meify(new_message, -1)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4917 str = g_malloc(1024);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4918
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4919 if (flags & GAIM_MESSAGE_AUTO_RESP) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4920 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4921 tag_start_offset += 4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4922 + strlen(AUTO_RESPONSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4923 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4924 g_snprintf(str, 1024, "***%s", alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4925 tag_start_offset += 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4926 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4927
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4928 if (flags & GAIM_MESSAGE_NICK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4929 strcpy(color, HIGHLIGHT_COLOR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4930 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4931 strcpy(color, "#062585");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4932 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4933 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4934 str = g_malloc(1024);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4935 if (flags & GAIM_MESSAGE_AUTO_RESP) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4936 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4937 tag_start_offset += 1
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4938 + strlen(AUTO_RESPONSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4939 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4940 g_snprintf(str, 1024, "%s:", alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4941 tag_end_offset = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4942 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4943 if (flags & GAIM_MESSAGE_NICK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4944 strcpy(color, HIGHLIGHT_COLOR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4945 else if (flags & GAIM_MESSAGE_RECV) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4946 if (type == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4947 GdkColor *col = get_nick_color(gtkconv, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4948
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4949 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4950 col->red >> 8, col->green >> 8, col->blue >> 8);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4951 } else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4952 strcpy(color, RECV_COLOR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4953 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4954 else if (flags & GAIM_MESSAGE_SEND)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4955 strcpy(color, SEND_COLOR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4956 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4957 gaim_debug_error("gtkconv", "message missing flags\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4958 strcpy(color, "#000000");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4959 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4960 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4961 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4962
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4963 g_free(alias_escaped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4964
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4965 /* Are we in a chat where we can tell which users are buddies? */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4966 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4967 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4968
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4969 /* Bold buddies to make them stand out from non-buddies. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4970 if (flags & GAIM_MESSAGE_SEND ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4971 flags & GAIM_MESSAGE_NICK ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4972 gaim_find_buddy(account, name) != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4973 g_snprintf(buf2, BUF_LONG,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4974 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4975 "<B>%s</B></FONT> ",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4976 color, sml_attrib ? sml_attrib : "", mdate, str);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4977 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4978 g_snprintf(buf2, BUF_LONG,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4979 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4980 "%s</FONT> ",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4981 color, sml_attrib ? sml_attrib : "", mdate, str);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4982
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4983 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4984 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4985 /* Bold everyone's name to make the name stand out from the message. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4986 g_snprintf(buf2, BUF_LONG,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4987 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4988 "<B>%s</B></FONT> ",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4989 color, sml_attrib ? sml_attrib : "", mdate, str);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4990 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4991
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4992 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4993
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4994 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4995 !(flags & GAIM_MESSAGE_SEND)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4996
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4997 GtkTextIter start, end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4998 GtkTextTag *buddytag = get_buddy_tag(conv, name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4999
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5000 gtk_text_buffer_get_end_iter(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5001 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5002 &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5003 gtk_text_iter_backward_chars(&end,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5004 tag_end_offset + 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5005
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5006 gtk_text_buffer_get_end_iter(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5007 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5008 &start);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5009 gtk_text_iter_backward_chars(&start,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5010 strlen(str) + 1 - tag_start_offset);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5011
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5012 gtk_text_buffer_apply_tag(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5013 GTK_IMHTML(gtkconv->imhtml)->text_buffer,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5014 buddytag, &start, &end);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5015 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5016
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5017 g_free(str);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5018
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5019 if(gc){
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5020 char *pre = g_strdup_printf("<font %s>", sml_attrib ? sml_attrib : "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5021 char *post = "</font>";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5022 int pre_len = strlen(pre);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5023 int post_len = strlen(post);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5024
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5025 with_font_tag = g_malloc(length + pre_len + post_len + 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5026
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5027 strcpy(with_font_tag, pre);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5028 memcpy(with_font_tag + pre_len, new_message, length);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5029 strcpy(with_font_tag + pre_len + length, post);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5030
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5031 length += pre_len + post_len;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5032 g_free(pre);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5033 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5034 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5035 with_font_tag = g_memdup(new_message, length);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5036
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5037 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5038 with_font_tag, gtk_font_options | gtk_font_options_all);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5039
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5040 if (flags & GAIM_MESSAGE_SEND)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5041 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5042 /* Restore the smiley-data */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5043 GTK_IMHTML(gtkconv->imhtml)->default_smilies = tree;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5044 GTK_IMHTML(gtkconv->imhtml)->smiley_data = smiley_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5045 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5046
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5047 g_free(with_font_tag);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5048 g_free(new_message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5049 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5050
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5051 g_free(mdate);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5052 g_free(sml_attrib);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5053
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5054 /* Tab highlighting stuff */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5055 if (!(flags & GAIM_MESSAGE_SEND) && !gaim_gtkconv_has_focus(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5056 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5057 GaimUnseenState unseen = GAIM_UNSEEN_NONE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5058
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5059 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5060 unseen = GAIM_UNSEEN_NICK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5061 else if (((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5062 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5063 unseen = GAIM_UNSEEN_EVENT;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5064 else if ((flags & GAIM_MESSAGE_NO_LOG) == GAIM_MESSAGE_NO_LOG)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5065 unseen = GAIM_UNSEEN_NO_LOG;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5066 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5067 unseen = GAIM_UNSEEN_TEXT;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5068
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5069 gtkconv_set_unseen(gtkconv, unseen);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5070 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5071
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5072 gaim_signal_emit(gaim_gtk_conversations_get_handle(),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5073 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5074 account, name, message, conv, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5075 g_free(displaying);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5076 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5077 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5078 gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5079 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5080 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5081 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5082 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5083 GtkListStore *ls;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5084 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5085
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5086 char tmp[BUF_LONG];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5087 int num_users;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5088
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5089 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5090 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5091 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5092
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5093 num_users = g_list_length(gaim_conv_chat_get_users(chat));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5094
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5095 g_snprintf(tmp, sizeof(tmp),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5096 ngettext("%d person in room", "%d people in room",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5097 num_users),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5098 num_users);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5099
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5100 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5101
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5102 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)));
14228
c18bdf510325 [gaim-migrate @ 16910]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14191
diff changeset
5103
c18bdf510325 [gaim-migrate @ 16910]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14191
diff changeset
5104 #if GTK_CHECK_VERSION(2,6,0)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5105 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5106 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID);
14228
c18bdf510325 [gaim-migrate @ 16910]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14191
diff changeset
5107 #endif
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5108
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5109 l = cbuddies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5110 while (l != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5111 add_chat_buddy_common(conv, (GaimConvChatBuddy *)l->data, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5112 l = l->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5113 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5114
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5115 /* Currently GTK+ maintains our sorted list after it's in the tree.
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5116 * This may change if it turns out we can manage it faster ourselves.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5117 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5118 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5119 GTK_SORT_ASCENDING);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5120 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5121
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5122 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5123 gaim_gtkconv_chat_rename_user(GaimConversation *conv, const char *old_name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5124 const char *new_name, const char *new_alias)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5125 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5126 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5127 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5128 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5129 GaimConvChatBuddyFlags flags;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5130 GaimConvChatBuddy *cbuddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5131 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5132 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5133 int f = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5134
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5135 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5136 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5137 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5138
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5139 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5140
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5141 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5142 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5143
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5144 while (f != 0) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5145 char *val;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5146
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5147 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5148
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5149 if (!gaim_utf8_strcasecmp(old_name, val)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5150 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5151 g_free(val);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5152 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5153 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5154
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5155 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5156
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5157 g_free(val);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5158 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5159
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5160 if (!gaim_conv_chat_find_user(chat, old_name))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5161 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5162
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5163 g_return_if_fail(new_alias != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5164
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5165 cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5166
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5167 add_chat_buddy_common(conv, cbuddy, old_name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5168 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5169
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5170 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5171 gaim_gtkconv_chat_remove_users(GaimConversation *conv, GList *users)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5172 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5173 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5174 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5175 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5176 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5177 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5178 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5179 char tmp[BUF_LONG];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5180 int num_users;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5181 gboolean f;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5182
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5183 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5184 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5185 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5187 num_users = g_list_length(gaim_conv_chat_get_users(chat));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5189 for (l = users; l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5190 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5192 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5193 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5194
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5195 do {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5196 char *val;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5197
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5198 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5199 CHAT_USERS_NAME_COLUMN, &val, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5200
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5201 if (!gaim_utf8_strcasecmp((char *)l->data, val)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5202 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5203 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5204 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5205 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5206 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5207 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5208 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5209 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5210 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5211
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5212 g_free(val);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5213 } while (f);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5214 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5215
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5216 g_snprintf(tmp, sizeof(tmp),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5217 ngettext("%d person in room", "%d people in room",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5218 num_users), num_users);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5219
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5220 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5221 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5222
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5223 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5224 gaim_gtkconv_chat_update_user(GaimConversation *conv, const char *user)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5225 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5226 GaimConvChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5227 GaimConvChatBuddyFlags flags;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5228 GaimConvChatBuddy *cbuddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5229 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5230 GaimGtkChatPane *gtkchat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5231 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5232 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5233 int f = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5234 char *alias = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5235
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5236 chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5237 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5238 gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5240 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5241
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5242 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5243 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5244
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5245 while (f != 0) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5246 char *val;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5247
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5248 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5249
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5250 if (!gaim_utf8_strcasecmp(user, val)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5251 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5252 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5253 g_free(val);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5254 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5255 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5256
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5257 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5258
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5259 g_free(val);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5260 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5261
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5262 if (!gaim_conv_chat_find_user(chat, user))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5263 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5264 g_free(alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5265 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5266 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5267
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5268 g_return_if_fail(alias != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5269
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5270 flags = gaim_conv_chat_user_get_flags(chat, user);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5271
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5272 cbuddy = gaim_conv_chat_cb_new(user, alias, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5273
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5274 add_chat_buddy_common(conv, cbuddy, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5275 g_free(alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5276 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5277
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5278 gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5279 gaim_gtkconv_has_focus(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5280 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5281 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5282 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5283 gboolean has_focus;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5284
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5285 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5286
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5287 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5288
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5289 if (has_focus && gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5290 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5291
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5292 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5293 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5294
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5295 static void gaim_gtkconv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5296 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5297 GtkIMHtmlSmiley *smiley;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5298
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5299 smiley = (GtkIMHtmlSmiley *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5300 smiley->icon = gdk_pixbuf_loader_get_animation(loader);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5301
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5302 if (smiley->icon)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5303 g_object_ref(G_OBJECT(smiley->icon));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5304 #ifdef DEBUG_CUSTOM_SMILEY
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5305 gaim_debug_info("custom-smiley", "gaim_gtkconv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5306 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5307 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5308
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5309 static void gaim_gtkconv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5310 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5311 GtkIMHtmlSmiley *smiley;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5312 GtkWidget *icon = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5313 GtkTextChildAnchor *anchor = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5314 GSList *current = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5315
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5316 smiley = (GtkIMHtmlSmiley *)user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5317 if (!smiley->imhtml) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5318 #ifdef DEBUG_CUSTOM_SMILEY
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5319 gaim_debug_error("custom-smiley", "gaim_gtkconv_custom_smiley_closed(): orphan smiley found: %p\n", smiley);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5320 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5321 g_object_unref(G_OBJECT(loader));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5322 smiley->loader = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5323 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5324 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5325
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5326 for (current = smiley->anchors; current; current = g_slist_next(current)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5327
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5328 icon = gtk_image_new_from_animation(smiley->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5330 #ifdef DEBUG_CUSTOM_SMILEY
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5331 gaim_debug_info("custom-smiley", "gaim_gtkconv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5332 icon, smiley->icon, smiley->smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5333 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5334 if (icon) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5335 gtk_widget_show(icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5336
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5337 anchor = GTK_TEXT_CHILD_ANCHOR(current->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5338
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5339 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", gaim_unescape_html(smiley->smile), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5340 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5341
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5342 if (smiley->imhtml)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5343 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5344 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5345
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5346 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5347
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5348 g_slist_free(smiley->anchors);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5349 smiley->anchors = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5350
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5351 g_object_unref(G_OBJECT(loader));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5352 smiley->loader = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5353 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5354
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5355 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5356 add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smile)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5357 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5358 GtkIMHtmlSmiley *smiley;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5359 GdkPixbufLoader *loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5360
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5361 smiley = gtk_imhtml_smiley_get(imhtml, sml, smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5362
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5363 if (smiley) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5364
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5365 if (!(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5366 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5367 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5368
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5369 /* Close the old GdkPixbufAnimation, then create a new one for
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5370 * the smiley we are about to receive */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5371 g_object_unref(G_OBJECT(smiley->icon));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5372
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5373 /* XXX: Is it necessary to _unref the loader first? */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5374 smiley->loader = gdk_pixbuf_loader_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5375 smiley->icon = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5376
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5377 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5378 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5379
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5380 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5381 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5382
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5383 loader = gdk_pixbuf_loader_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5384
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5385 /* this is wrong, this file ought not call g_new on GtkIMHtmlSmiley */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5386 /* Let gtk_imhtml have a gtk_imhtml_smiley_new function, and let
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5387 GtkIMHtmlSmiley by opaque */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5388 smiley = g_new0(GtkIMHtmlSmiley, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5389 smiley->file = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5390 smiley->smile = g_strdup(smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5391 smiley->loader = loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5392 smiley->flags = smiley->flags | GTK_IMHTML_SMILEY_CUSTOM;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5393
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5394 g_signal_connect(smiley->loader, "area_prepared", G_CALLBACK(gaim_gtkconv_custom_smiley_allocated), smiley);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5395 g_signal_connect(smiley->loader, "closed", G_CALLBACK(gaim_gtkconv_custom_smiley_closed), smiley);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5396
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5397 gtk_imhtml_associate_smiley(imhtml, sml, smiley);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5398
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5399 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5400 }
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5401
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5402 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5403 gaim_gtkconv_custom_smiley_add(GaimConversation *conv, const char *smile, gboolean remote)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5404 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5405 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5406 struct smiley_list *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5407 const char *sml = NULL, *conv_sml;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5408
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5409 if (!conv || !smile || !*smile) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5410 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5411 }
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5412
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5413 /* If smileys are off, return false */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5414 if (gaim_gtkthemes_smileys_disabled())
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5415 return FALSE;
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5416
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5417 /* If possible add this smiley to the current theme.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5418 * The addition is only temporary: custom smilies aren't saved to disk. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5419 conv_sml = gaim_account_get_protocol_name(conv->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5420 gtkconv = GAIM_GTK_CONVERSATION(conv);
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5421
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5422 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5423 if (!strcmp(list->sml, conv_sml)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5424 sml = list->sml;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5425 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5426 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5427 }
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5428
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5429 if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->imhtml), sml, smile))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5430 return FALSE;
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
5431
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5432 if (!remote) /* If it's a local custom smiley, then add it for the entry */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5433 if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->entry), sml, smile))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5434 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5436 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5437 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5438
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5439 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5440 gaim_gtkconv_custom_smiley_write(GaimConversation *conv, const char *smile,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5441 const guchar *data, gsize size)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5442 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5443 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5444 GtkIMHtmlSmiley *smiley;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5445 GdkPixbufLoader *loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5446 const char *sml;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5447
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5448 sml = gaim_account_get_protocol_name(conv->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5449 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5450 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5451
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5452 if (!smiley)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5453 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5454
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5455 loader = smiley->loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5456 if (!loader)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5457 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5458
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5459 gdk_pixbuf_loader_write(loader, data, size, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5460 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5461
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5462 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5463 gaim_gtkconv_custom_smiley_close(GaimConversation *conv, const char *smile)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5464 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5465 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5466 GtkIMHtmlSmiley *smiley;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5467 GdkPixbufLoader *loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5468 const char *sml;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5469
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5470 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5471 g_return_if_fail(smile != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5472
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5473 sml = gaim_account_get_protocol_name(conv->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5474 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5475 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5476
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5477 if (!smiley)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5478 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5479
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5480 loader = smiley->loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5481
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5482 if (!loader)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5483 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5484
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5485
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5486
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5487 gaim_debug_info("gtkconv", "About to close the smiley pixbuf\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5488
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5489 gdk_pixbuf_loader_close(loader, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5490
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5491 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5492
14520
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5493 static void
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5494 gaim_gtkconv_send_confirm(GaimConversation *conv, const char *message)
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5495 {
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5496 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5497
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5498 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0);
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5499 }
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5500
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5501 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5502 * Makes sure all the menu items and all the buttons are hidden/shown and
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5503 * sensitive/insensitive. This is called after changing tabs and when an
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5504 * account signs on or off.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5505 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5506 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5507 gray_stuff_out(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5508 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5509 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5510 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5511 GaimConnection *gc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5512 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5513 GdkPixbuf *window_icon = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5514 GtkIMHtmlButtons buttons;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5515 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5516
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5517 win = gaim_gtkconv_get_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5518 gc = gaim_conversation_get_gc(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5519 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5520
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5521 if (gc != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5522 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5523
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5524 if (win->menu.send_to != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5525 update_send_to_selection(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5526
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5527 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5528 * Handle hiding and showing stuff based on what type of conv this is.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5529 * Stuff that Gaim IMs support in general should be shown for IM
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5530 * conversations. Stuff that Gaim chats support in general should be
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5531 * shown for chat conversations. It doesn't matter whether the PRPL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5532 * supports it or not--that only affects if the button or menu item
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5533 * is sensitive or not.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5534 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5535 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5536 /* Show stuff that applies to IMs, hide stuff that applies to chats */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5537
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5538 /* Deal with menu items */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5539 gtk_widget_show(win->menu.view_log);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5540 gtk_widget_show(win->menu.send_file);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5541 gtk_widget_show(win->menu.add_pounce);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5542 gtk_widget_show(win->menu.get_info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5543 gtk_widget_hide(win->menu.invite);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5544 gtk_widget_show(win->menu.alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5545 gtk_widget_show(win->menu.block);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5546
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5547 if ((account == NULL) || gaim_find_buddy(account, gaim_conversation_get_name(conv)) == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5548 gtk_widget_show(win->menu.add);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5549 gtk_widget_hide(win->menu.remove);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5550 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5551 gtk_widget_show(win->menu.remove);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5552 gtk_widget_hide(win->menu.add);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5553 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5555 gtk_widget_show(win->menu.insert_link);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5556 gtk_widget_show(win->menu.insert_image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5557 gtk_widget_show(win->menu.show_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5558 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5559 /* Show stuff that applies to Chats, hide stuff that applies to IMs */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5561 /* Deal with menu items */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5562 gtk_widget_show(win->menu.view_log);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5563 gtk_widget_hide(win->menu.send_file);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5564 gtk_widget_hide(win->menu.add_pounce);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5565 gtk_widget_hide(win->menu.get_info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5566 gtk_widget_show(win->menu.invite);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5567 gtk_widget_show(win->menu.alias);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5568 gtk_widget_hide(win->menu.block);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5569 gtk_widget_hide(win->menu.show_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5570
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5571 if ((account == NULL) || gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5572 /* If the chat is NOT in the buddy list */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5573 gtk_widget_show(win->menu.add);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5574 gtk_widget_hide(win->menu.remove);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5575 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5576 /* If the chat IS in the buddy list */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5577 gtk_widget_hide(win->menu.add);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5578 gtk_widget_show(win->menu.remove);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5579 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5580
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5581 gtk_widget_show(win->menu.insert_link);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5582 gtk_widget_hide(win->menu.insert_image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5583 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5584
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5585 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5586 * Handle graying stuff out based on whether an account is connected
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5587 * and what features that account supports.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5588 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5589 if ((gc != NULL) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5590 ((gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5591 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) ))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5592 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5593 /* Account is online */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5594 /* Deal with the toolbar */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5595 if (conv->features & GAIM_CONNECTION_HTML)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5596 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5597 buttons = GTK_IMHTML_ALL; /* Everything on */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5598 if (conv->features & GAIM_CONNECTION_NO_BGCOLOR)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5599 buttons &= ~GTK_IMHTML_BACKCOLOR;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5600 if (conv->features & GAIM_CONNECTION_NO_FONTSIZE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5601 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5602 buttons &= ~GTK_IMHTML_GROW;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5603 buttons &= ~GTK_IMHTML_SHRINK;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5604 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5605 if (conv->features & GAIM_CONNECTION_NO_URLDESC)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5606 buttons &= ~GTK_IMHTML_LINKDESC;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5607 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5608 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5609 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5610
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5611 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5612 conv->features & GAIM_CONNECTION_NO_IMAGES)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5613 buttons &= ~GTK_IMHTML_IMAGE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5614
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5615 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5616 if (account != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5617 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5618
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5619 /* Deal with menu items */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5620 gtk_widget_set_sensitive(win->menu.view_log, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5621 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5622 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5623 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5624 gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & GAIM_CONNECTION_HTML));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5625 gtk_widget_set_sensitive(win->menu.insert_image, (prpl_info->options & OPT_PROTO_IM_IMAGE) && !(conv->features & GAIM_CONNECTION_NO_IMAGES));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5626
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5627 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5628 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5629 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5630 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5631 gtk_widget_set_sensitive(win->menu.send_file,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5632 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5633 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv)))));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5634 gtk_widget_set_sensitive(win->menu.alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5635 (account != NULL) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5636 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5637 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5638 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5639 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5640 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5641 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5642 gtk_widget_set_sensitive(win->menu.alias,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5643 (account != NULL) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5644 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5645 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5647 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5648 /* Account is offline */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5649 /* Or it's a chat that we've left. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5650
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5651 /* Then deal with menu items */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5652 gtk_widget_set_sensitive(win->menu.view_log, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5653 gtk_widget_set_sensitive(win->menu.send_file, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5654 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5655 gtk_widget_set_sensitive(win->menu.get_info, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5656 gtk_widget_set_sensitive(win->menu.invite, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5657 gtk_widget_set_sensitive(win->menu.alias, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5658 gtk_widget_set_sensitive(win->menu.add, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5659 gtk_widget_set_sensitive(win->menu.remove, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5660 gtk_widget_set_sensitive(win->menu.insert_link, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5661 gtk_widget_set_sensitive(win->menu.insert_image, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5662 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5663
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5664 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5665 * Update the window's icon
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5666 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5667 if (gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5668 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5669 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5670 (gtkconv->u.im->anim))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5671 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5672 window_icon =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5673 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5674 g_object_ref(window_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5675 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5676 window_icon = gaim_gtkconv_get_tab_icon(conv, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5677 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5678 gtk_window_set_icon(GTK_WINDOW(win->window), window_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5679 if (window_icon != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5680 g_object_unref(G_OBJECT(window_icon));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5681 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5682 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5683
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5684 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5685 gaim_gtkconv_update_fields(GaimConversation *conv, GaimGtkConvFields fields)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5686 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5687 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5688 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5689
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5690 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5691 if (!gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5692 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5693 win = gaim_gtkconv_get_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5694 if (!win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5695 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5696
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5697 if (fields & GAIM_GTKCONV_SET_TITLE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5698 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5699 gaim_conversation_autoset_title(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5700 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5701
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5702 if (fields & GAIM_GTKCONV_BUDDY_ICON)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5703 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5704 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5705 gaim_gtkconv_update_buddy_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5706 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5707
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5708 if (fields & GAIM_GTKCONV_MENU)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5709 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5710 gray_stuff_out(GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5711 generate_send_to_items(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5712 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5713
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5714 if (fields & GAIM_GTKCONV_TAB_ICON)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5715 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5716 update_tab_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5717 generate_send_to_items(win); /* To update the icons in SendTo menu */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5718 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5719
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5720 if ((fields & GAIM_GTKCONV_TOPIC) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5721 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5722 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5723 const char *topic;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5724 GaimConvChat *chat = GAIM_CONV_CHAT(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5725 GaimGtkChatPane *gtkchat = gtkconv->u.chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5727 if (gtkchat->topic_text != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5728 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5729 topic = gaim_conv_chat_get_topic(chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5730
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5731 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5732 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5733 topic ? topic : "", NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5734 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5735 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5736
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5737 if (fields & GAIM_GTKCONV_SMILEY_THEME)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5738 gaim_gtkthemes_smiley_themeize(GAIM_GTK_CONVERSATION(conv)->imhtml);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5739
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5740 if ((fields & GAIM_GTKCONV_COLORIZE_TITLE) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5741 (fields & GAIM_GTKCONV_SET_TITLE))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5742 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5743 char *title;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5744 GaimConvIm *im = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5745 GaimAccount *account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5746 AtkObject *accessibility_obj;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5747 /* I think this is a little longer than it needs to be but I'm lazy. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5748 char style[51];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5749
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5750 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5751 im = GAIM_CONV_IM(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5752
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5753 if ((account == NULL) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5754 !gaim_account_is_connected(account) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5755 ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5756 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5757 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5758 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5759 title = g_strdup(gaim_conversation_get_title(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5760
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5761 *style = '\0';
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5762
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5763 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5764 gtk_widget_realize(gtkconv->tab_label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5765
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5766 accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5767 if (im != NULL &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5768 gaim_conv_im_get_typing_state(im) == GAIM_TYPING)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5769 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5770 atk_object_set_description(accessibility_obj, _("Typing"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5771 strncpy(style, "color=\"#47A046\"", sizeof(style));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5772 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5773 else if (im != NULL &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5774 gaim_conv_im_get_typing_state(im) == GAIM_TYPED)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5775 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5776 atk_object_set_description(accessibility_obj, _("Stopped Typing"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5777 strncpy(style, "color=\"#D1940C\"", sizeof(style));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5778 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5779 else if (gtkconv->unseen_state == GAIM_UNSEEN_NICK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5780 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5781 atk_object_set_description(accessibility_obj, _("Nick Said"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5782 strncpy(style, "color=\"#0D4E91\" style=\"italic\" weight=\"bold\"", sizeof(style));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5783 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5784 else if (gtkconv->unseen_state == GAIM_UNSEEN_TEXT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5785 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5786 atk_object_set_description(accessibility_obj, _("Unread Messages"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5787 strncpy(style, "color=\"#DF421E\" weight=\"bold\"", sizeof(style));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5788 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5789 else if (gtkconv->unseen_state == GAIM_UNSEEN_EVENT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5790 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5791 atk_object_set_description(accessibility_obj, _("New Event"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5792 strncpy(style, "color=\"#868272\" style=\"italic\"", sizeof(style));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5793 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5794
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5795 if (*style != '\0')
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5796 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5797 char *html_title,*label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5798
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5799 html_title = g_markup_escape_text(title, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5800
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5801 label = g_strdup_printf("<span %s>%s</span>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5802 style, html_title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5803 g_free(html_title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5804 gtk_label_set_markup(GTK_LABEL(gtkconv->tab_label), label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5805 g_free(label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5806 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5807 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5808 gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5809
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5810 if (gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5811 update_typing_icon(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5812
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5813 gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5814 if (gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5815 gtk_window_set_title(GTK_WINDOW(win->window), title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5817 g_free(title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5818 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5819 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5820
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5821 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5822 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5823 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5824 GaimGtkConvFields flags = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5825
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5826 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5827
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5828 if (type == GAIM_CONV_UPDATE_ACCOUNT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5829 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5830 flags = GAIM_GTKCONV_ALL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5831 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5832 else if (type == GAIM_CONV_UPDATE_TYPING ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5833 type == GAIM_CONV_UPDATE_UNSEEN ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5834 type == GAIM_CONV_UPDATE_TITLE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5835 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5836 flags = GAIM_GTKCONV_COLORIZE_TITLE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5837 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5838 else if (type == GAIM_CONV_UPDATE_TOPIC)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5839 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5840 flags = GAIM_GTKCONV_TOPIC;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5841 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5842 else if (type == GAIM_CONV_ACCOUNT_ONLINE ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5843 type == GAIM_CONV_ACCOUNT_OFFLINE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5844 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5845 flags = GAIM_GTKCONV_MENU | GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_SET_TITLE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5846 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5847 else if (type == GAIM_CONV_UPDATE_AWAY)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5848 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5849 flags = GAIM_GTKCONV_TAB_ICON;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5850 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5851 else if (type == GAIM_CONV_UPDATE_ADD ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5852 type == GAIM_CONV_UPDATE_REMOVE ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5853 type == GAIM_CONV_UPDATE_CHATLEFT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5854 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5855 flags = GAIM_GTKCONV_SET_TITLE | GAIM_GTKCONV_MENU;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5856 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5857 else if (type == GAIM_CONV_UPDATE_ICON)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5858 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5859 flags = GAIM_GTKCONV_BUDDY_ICON;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5860 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5861 else if (type == GAIM_CONV_UPDATE_FEATURES)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5862 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5863 flags = GAIM_GTKCONV_MENU;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5864 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5865
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5866 gaim_gtkconv_update_fields(conv, flags);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5867 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5868
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5869 static GaimConversationUiOps conversation_ui_ops =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5870 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5871 gaim_gtkconv_new,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5872 gaim_gtkconv_destroy, /* destroy_conversation */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5873 NULL, /* write_chat */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5874 gaim_gtkconv_write_im, /* write_im */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5875 gaim_gtkconv_write_conv, /* write_conv */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5876 gaim_gtkconv_chat_add_users, /* chat_add_users */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5877 gaim_gtkconv_chat_rename_user, /* chat_rename_user */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5878 gaim_gtkconv_chat_remove_users, /* chat_remove_users */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5879 gaim_gtkconv_chat_update_user, /* chat_update_user */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5880 gaim_gtkconv_present_conversation, /* present */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5881 gaim_gtkconv_has_focus, /* has_focus */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5882 gaim_gtkconv_custom_smiley_add, /* custom_smiley_add */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5883 gaim_gtkconv_custom_smiley_write, /* custom_smiley_write */
14520
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5884 gaim_gtkconv_custom_smiley_close, /* custom_smiley_close */
82b59abcaee4 [gaim-migrate @ 17240]
Richard Laager <rlaager@wiktel.com>
parents: 14370
diff changeset
5885 gaim_gtkconv_send_confirm, /* send_confirm */
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5886 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5887
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5888 GaimConversationUiOps *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5889 gaim_gtk_conversations_get_conv_ui_ops(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5890 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5891 return &conversation_ui_ops;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5892 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5893
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5894 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5895 * Public conversation utility functions
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5896 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5897 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5898 gaim_gtkconv_update_buddy_icon(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5899 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5900 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5901 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5902
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5903 GdkPixbufLoader *loader;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5904 GdkPixbufAnimation *anim;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5905 GError *err = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5906
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5907 const char *custom = NULL;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5908 const void *data = NULL;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5909 size_t len;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5910
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5911 GdkPixbuf *buf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5912
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5913 GtkWidget *event;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5914 GtkWidget *frame;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5915 GdkPixbuf *scale;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5916 int scale_width, scale_height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5917
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5918 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5919 GaimPluginProtocolInfo *prpl_info = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5920
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5921 GaimBuddyIcon *icon;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5922
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5923 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5924 g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5925 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5926
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5927 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5928 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5929 if (conv != gtkconv->active_conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5930 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5931
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5932 if (!gtkconv->u.im->show_icon)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5933 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5934
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5935 account = gaim_conversation_get_account(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5936 if(account && account->gc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5937 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5938
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5939 /* Remove the current icon stuff */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5940 if (gtkconv->u.im->icon_container != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5941 gtk_widget_destroy(gtkconv->u.im->icon_container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5942 gtkconv->u.im->icon_container = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5943
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5944 if (gtkconv->u.im->anim != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5945 g_object_unref(G_OBJECT(gtkconv->u.im->anim));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5946
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5947 gtkconv->u.im->anim = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5948
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5949 if (gtkconv->u.im->icon_timer != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5950 g_source_remove(gtkconv->u.im->icon_timer);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5951
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5952 gtkconv->u.im->icon_timer = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5953
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5954 if (gtkconv->u.im->iter != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5955 g_object_unref(G_OBJECT(gtkconv->u.im->iter));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5956
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5957 gtkconv->u.im->iter = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5958
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5959 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5960 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5961
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5962 if (gaim_conversation_get_gc(conv) == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5963 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5964
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5965 custom = custom_icon_pref_name(gtkconv);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5966 if (custom) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5967 /* There is a custom icon for this user */
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5968 char *contents = NULL;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5969 if (!g_file_get_contents(custom, &contents, &len, &err)) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5970 gaim_debug_warning("custom icon", "could not load custom icon %s for %s\n",
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5971 custom, gaim_conversation_get_name(conv));
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5972 g_error_free(err);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5973 err = NULL;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5974 } else
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5975 data = contents;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5976 }
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5977
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5978 if (data == NULL) {
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5979 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv));
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5980
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5981 if (icon == NULL)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5982 return;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5983
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5984 data = gaim_buddy_icon_get_data(icon, &len);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5985 custom = NULL;
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5986 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5987
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5988 loader = gdk_pixbuf_loader_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5989 gdk_pixbuf_loader_write(loader, data, len, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5990 gdk_pixbuf_loader_close(loader, &err);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5991 anim = gdk_pixbuf_loader_get_animation(loader);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5992 if (anim)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5993 g_object_ref(G_OBJECT(anim));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5994 g_object_unref(loader);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5995
14852
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5996 if (custom)
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5997 g_free((void*)data);
cf25420b074d [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14816
diff changeset
5998
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5999 if (!anim)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6000 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6001 gtkconv->u.im->anim = anim;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6002
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6003 if (err) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6004 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6005 "Buddy icon error: %s\n", err->message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6006 g_error_free(err);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6007 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6008
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6009 if (!gtkconv->u.im->anim)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6010 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6011
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6012 if (gdk_pixbuf_animation_is_static_image(gtkconv->u.im->anim)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6013 gtkconv->u.im->iter = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6014 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6015 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6016 gtkconv->u.im->iter =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6017 gdk_pixbuf_animation_get_iter(gtkconv->u.im->anim, NULL); /* LEAK */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6018 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6019 if (gtkconv->u.im->animate)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6020 start_anim(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6021 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6022
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6023 gaim_gtk_buddy_icon_get_scale_size(buf, prpl_info ? &prpl_info->icon_spec :
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6024 NULL, &scale_width, &scale_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6025 scale = gdk_pixbuf_scale_simple(buf,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6026 MAX(gdk_pixbuf_get_width(buf) * scale_width /
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6027 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6028 MAX(gdk_pixbuf_get_height(buf) * scale_height /
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6029 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6030 GDK_INTERP_BILINEAR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6031
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6032 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6033
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6034 frame = gtk_frame_new(NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6035 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6036 gtk_box_pack_start(GTK_BOX(gtkconv->u.im->icon_container), frame,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6037 FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6038
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6039 event = gtk_event_box_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6040 gtk_container_add(GTK_CONTAINER(frame), event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6041 g_signal_connect(G_OBJECT(event), "button-press-event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6042 G_CALLBACK(icon_menu), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6043 gtk_widget_show(event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6044
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6045 gtkconv->u.im->icon = gtk_image_new_from_pixbuf(scale);
14592
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
6046 gtkconv->auto_resize = TRUE;
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
6047 /* Reset the size request to allow the buddy icon to resize */
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
6048 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, -1);
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
6049 g_idle_add(reset_auto_resize_cb, gtkconv);
f407d80a618c [gaim-migrate @ 17316]
Sean Egan <seanegan@gmail.com>
parents: 14591
diff changeset
6050 printf("Auto resize true\n");
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6051 gtk_widget_set_size_request(gtkconv->u.im->icon, scale_width, scale_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6052 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6053 gtk_widget_show(gtkconv->u.im->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6054
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6055 g_object_unref(G_OBJECT(scale));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6056
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6057 gtk_box_pack_start(GTK_BOX(gtkconv->lower_hbox),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6058 gtkconv->u.im->icon_container, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6059
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6060 gtk_widget_show(gtkconv->u.im->icon_container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6061 gtk_widget_show(frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6062
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6063 /* The buddy icon code needs badly to be fixed. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6064 if(gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6065 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6066 buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6067 gtk_window_set_icon(GTK_WINDOW(win->window), buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6068 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6069 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6070
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6071 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6072 gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6073 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6074 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6075
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6076 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6077 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6078
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6079 win = GAIM_GTK_CONVERSATION(conv)->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6080
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6081 if (win != NULL && gaim_gtk_conv_window_is_active_conversation(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6082 gray_stuff_out(GAIM_GTK_CONVERSATION(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6083 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6084
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6085 int
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6086 gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6087 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6088 gint nb_x, nb_y, x_rel, y_rel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6089 GtkNotebook *notebook;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6090 GtkWidget *page, *tab;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6091 gint i, page_num = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6092 gint count;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6093 gboolean horiz;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6094
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6095 if (to_right)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6096 *to_right = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6097
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6098 notebook = GTK_NOTEBOOK(win->notebook);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6099
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6100 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6101 x_rel = x - nb_x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6102 y_rel = y - nb_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6104 horiz = (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6105 gtk_notebook_get_tab_pos(notebook) == GTK_POS_BOTTOM);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6106
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6107 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6108 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6109 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6110 /* this is hacky, but it's only for Gtk 2.0.0... */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6111 count = g_list_length(GTK_NOTEBOOK(notebook)->children);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6112 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6113
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6114 for (i = 0; i < count; i++) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6115
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6116 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6117 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6118
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6119 if (horiz) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6120 if (x_rel >= tab->allocation.x - GAIM_HIG_BOX_SPACE &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6121 x_rel <= tab->allocation.x + tab->allocation.width + GAIM_HIG_BOX_SPACE) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6122 page_num = i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6123
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6124 if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6125 *to_right = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6126
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6127 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6128 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6129 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6130 if (y_rel >= tab->allocation.y - GAIM_HIG_BOX_SPACE &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6131 y_rel <= tab->allocation.y + tab->allocation.height + GAIM_HIG_BOX_SPACE) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6132 page_num = i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6133
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6134 if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6135 *to_right = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6136
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6137 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6138 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6139 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6140 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6141
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6142 if (page_num == -1) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6143 /* Add after the last tab */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6144 page_num = count - 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6145 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6146
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6147 return page_num;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6148 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6149
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6150 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6151 close_on_tabs_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6152 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6153 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6154 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6155 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6156 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6157
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6158 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6159 conv = (GaimConversation *)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6160
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6161 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6162 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6163
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6164 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6165
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6166 if (value)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6167 gtk_widget_show(gtkconv->close);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6168 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6169 gtk_widget_hide(gtkconv->close);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6170 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6171 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6172
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6173 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6174 spellcheck_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6175 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6176 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6177 #ifdef USE_GTKSPELL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6178 GList *cl;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6179 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6180 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6181 GtkSpell *spell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6182
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6183 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6184
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6185 conv = (GaimConversation *)cl->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6187 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6188 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6189
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6190 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6192 if (value)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6193 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6194 else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6195 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6196 gtkspell_detach(spell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6197 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6198 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6199 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6200 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6201
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6202 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6203 tab_side_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6204 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6205 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6206 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6207 GtkPositionType pos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6208 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6209
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6210 pos = GPOINTER_TO_INT(value);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6211
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6212 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6213 win = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6215 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6216 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6217 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6218
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6219 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6220 show_timestamps_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6221 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6222 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6223 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6224 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6225 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6226 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6227
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6228 for (l = gaim_get_conversations(); l != NULL; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6229 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6230 conv = (GaimConversation *)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6231
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6232 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6233 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6234
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6235 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6236 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6237
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6238 gtk_check_menu_item_set_active(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6239 GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6240 (gboolean)GPOINTER_TO_INT(value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6241
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6242 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6243 (gboolean)GPOINTER_TO_INT(value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6244 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6245 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6246
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6247 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6248 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6249 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6250 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6251 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6252 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6253 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6254 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6255
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6256 for (l = gaim_get_conversations(); l != NULL; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6257 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6258 conv = (GaimConversation *)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6259
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6260 if (!GAIM_IS_GTK_CONVERSATION(conv))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6261 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6262
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6263 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6264 win = gtkconv->win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6265
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6266 gtk_check_menu_item_set_active(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6267 GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6268 (gboolean)GPOINTER_TO_INT(value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6269
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6270 if ((gboolean)GPOINTER_TO_INT(value))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6271 gtk_widget_show(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6272 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6273 gtk_widget_hide(gtkconv->toolbar);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6274 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6275 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6276
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6277 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6278 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6279 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6280 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6281 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6282 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6283 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6284 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6285
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6286 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6287 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6288
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6289 /* Set the "animate" flag for each icon based on the new preference */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6290 for (l = gaim_get_ims(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6291 conv = (GaimConversation *)l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6292 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6293 gtkconv->u.im->animate = GPOINTER_TO_INT(value);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6294 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6295
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6296 /* Now either stop or start animation for the active conversation in each window */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6297 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6298 win = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6299 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6300 gaim_gtkconv_update_buddy_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6301 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6302 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6303
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6304 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6305 show_buddy_icons_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6306 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6307 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6308 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6309
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6310 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6311 GaimConversation *conv = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6312
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6313 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6314 gaim_gtkconv_update_buddy_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6315 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6316 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6317
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6318 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6319 conv_placement_usetabs_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6320 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6321 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6322 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6323 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6324
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6325 static void
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
6326 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus,
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6327 GaimStatus *newstatus)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6328 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6329 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6330 GaimConversation *conv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6331 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6332
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6333 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6334 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6335
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6336 if(gaim_status_is_available(oldstatus) || !gaim_status_is_available(newstatus))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6337 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6338
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6339 while ((l = hidden_convwin->gtkconvs) != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6340 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6341 gtkconv = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6342
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6343 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6344
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6345 while(l && !gaim_status_is_available(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6346 gaim_account_get_active_status(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6347 gaim_conversation_get_account(conv))))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6348 l = l->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6349 if (!l)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6350 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6352 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6353 gaim_gtkconv_placement_place(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6354 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6355 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6356
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6357 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6358 hide_new_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6359 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6360 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6361 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6362 GaimConversation *conv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6363 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6364 gboolean when_away = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6365
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6366 if(!hidden_convwin)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6367 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6368
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6369 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6370 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6372 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6373 when_away = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6375 while ((l = hidden_convwin->gtkconvs) != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6376 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6377 gtkconv = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6378
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6379 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6380
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6381 if(when_away && !gaim_status_is_available(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6382 gaim_account_get_active_status(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6383 gaim_conversation_get_account(conv))))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6384 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6385
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6386 gaim_gtk_conv_window_remove_gtkconv(hidden_convwin, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6387 gaim_gtkconv_placement_place(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6388 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6389 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6390
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6391
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6392 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6393 conv_placement_pref_cb(const char *name, GaimPrefType type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6394 gconstpointer value, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6395 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6396 GaimConvPlacementFunc func;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6397
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6398 if (strcmp(name, "/gaim/gtk/conversations/placement"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6399 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6400
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6401 func = gaim_gtkconv_placement_get_fnc(value);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6402
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6403 if (func == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6404 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6405
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6406 gaim_gtkconv_placement_set_current_func(func);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6407 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6408
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6409 static GaimGtkConversation *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6410 get_gtkconv_with_contact(GaimContact *contact)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6411 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6412 GaimBlistNode *node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6413
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6414 node = ((GaimBlistNode*)contact)->child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6416 for (; node; node = node->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6417 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6418 GaimBuddy *buddy = (GaimBuddy*)node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6419 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6420 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6421 if (conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6422 return GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6423 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6424 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6425 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6426
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6427 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6428 account_signed_off_cb(GaimConnection *gc, gpointer event)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6429 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6430 GList *iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6431
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6432 for (iter = gaim_get_conversations(); iter; iter = iter->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6433 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6434 GaimConversation *conv = iter->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6436 /* This seems fine in theory, but we also need to cover the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6437 * case of this account matching one of the other buddies in
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6438 * one of the contacts containing the buddy corresponding to
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6439 * a conversation. It's easier to just update them all. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6440 /* if (gaim_conversation_get_account(conv) == account) */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6441 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6442 GAIM_GTKCONV_MENU | GAIM_GTKCONV_COLORIZE_TITLE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6443 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6444 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6445
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6446 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6447 update_buddy_status_timeout(GaimBuddy *buddy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6448 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6449 /* To remove the signing-on/off door icon */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6450 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6451
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6452 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6453 if (conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6454 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6455
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6456 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6457 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6458
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6459 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6460 update_buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *newstatus)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6461 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6462 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6463 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6464
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6465 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6466 if (gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6467 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6468 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6469 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_COLORIZE_TITLE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6470 if ((gaim_status_is_online(old) ^ gaim_status_is_online(newstatus)) != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6471 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_MENU);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6472 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6473
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6474 /* In case a conversation is started after the buddy has signed-on/off */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6475 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6476 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6477
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6478 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6479 update_buddy_privacy_changed(GaimBuddy *buddy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6480 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6481 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6482 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6483
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6484 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6485 if (gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6486 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6487 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6488 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6489 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6490 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6491
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6492 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6493 update_buddy_idle_changed(GaimBuddy *buddy, gboolean old, gboolean newidle)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6494 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6495 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6496
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6497 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6498 if (conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6499 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6500 }
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
6501
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6502 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6503 update_buddy_icon(GaimBuddy *buddy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6504 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6505 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6507 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6508 if (conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6509 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_BUDDY_ICON);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6510 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6511
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6512 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6513 update_buddy_sign(GaimBuddy *buddy, const char *which)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6514 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6515 GaimPresence *presence;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6516 GaimStatus *on, *off;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6517
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6518 presence = gaim_buddy_get_presence(buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6519 if (!presence)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6520 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6521 off = gaim_presence_get_status(presence, "offline");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6522 on = gaim_presence_get_status(presence, "available");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6523
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6524 if (*(which+1) == 'f')
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6525 update_buddy_status_changed(buddy, on, off);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6526 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6527 update_buddy_status_changed(buddy, off, on);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6528 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6529
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6530 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6531 update_conversation_switched(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6532 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6533 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON | GAIM_GTKCONV_SET_TITLE |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6534 GAIM_GTKCONV_MENU | GAIM_GTKCONV_BUDDY_ICON);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6535 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6536
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6537 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6538 update_buddy_typing(GaimAccount *account, const char *who)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6539 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6540 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6541 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6542
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6543 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6544 if (!conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6545 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6546
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6547 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6548 if (gtkconv && gtkconv->active_conv == conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6549 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_COLORIZE_TITLE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6550 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6551
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6552 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6553 update_chat(GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6554 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6555 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TOPIC |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6556 GAIM_GTKCONV_MENU | GAIM_GTKCONV_SET_TITLE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6557 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6558
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6559 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6560 update_chat_topic(GaimConversation *conv, const char *old, const char *new)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6561 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6562 gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TOPIC);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6563 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6564
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6565 void *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6566 gaim_gtk_conversations_get_handle(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6567 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6568 static int handle;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6569
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6570 return &handle;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6571 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6572
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6573 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6574 gaim_gtk_conversations_init(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6575 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6576 void *handle = gaim_gtk_conversations_get_handle();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6577 void *blist_handle = gaim_blist_get_handle();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6578
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6579 /* Conversations */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6580 gaim_prefs_add_none("/gaim/gtk/conversations");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6581 gaim_prefs_add_bool("/gaim/gtk/conversations/use_smooth_scrolling", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6582 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6583 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6584 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6585 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6586 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6587 gaim_prefs_add_bool("/gaim/gtk/conversations/show_incoming_formatting", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6588
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6589 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6590 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6591
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6592 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6593 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6594 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6595 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6596 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", "");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6597 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6598 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6599 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6600 gaim_prefs_add_int("/gaim/gtk/conversations/scrollback_lines", 4000);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6601
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6602 /* Conversations -> Chat */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6603 gaim_prefs_add_none("/gaim/gtk/conversations/chat");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6604 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6605 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6606 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50);
14591
fc99573b0b62 [gaim-migrate @ 17315]
Sean Egan <seanegan@gmail.com>
parents: 14584
diff changeset
6607 gaim_prefs_add_int("/gaim/gtk/conversations/chat/userlist_width", 80);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6608 /* Conversations -> IM */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6609 gaim_prefs_add_none("/gaim/gtk/conversations/im");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6610
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6611 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6613 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6614 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6615 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6616 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6617
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6618 gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "never");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6619
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6620 /* Connect callbacks. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6621 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6622 close_on_tabs_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6623 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_timestamps",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6624 show_timestamps_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6625 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_formatting_toolbar",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6626 show_formatting_toolbar_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6627 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/spellcheck",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6628 spellcheck_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6629 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tab_side",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6630 tab_side_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6631
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6632 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tabs",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6633 conv_placement_usetabs_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6634
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6635 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/placement",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6636 conv_placement_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6637 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6638
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6639 /* IM callbacks */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6640 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/animate_buddy_icons",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6641 animate_buddy_icons_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6642 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/show_buddy_icons",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6643 show_buddy_icons_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6644 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/hide_new",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6645 hide_new_pref_cb, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6647
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6648
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6649 /**********************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6650 * Register signals
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6651 **********************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6652 gaim_signal_register(handle, "conversation-dragging",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6653 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6654 gaim_value_new(GAIM_TYPE_BOXED,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6655 "GaimGtkWindow *"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6656 gaim_value_new(GAIM_TYPE_BOXED,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6657 "GaimGtkWindow *"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6658
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6659 gaim_signal_register(handle, "conversation-timestamp",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6660 #if SIZEOF_TIME_T == 4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6661 gaim_marshal_POINTER__POINTER_INT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6662 #elif SIZEOF_TIME_T == 8
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6663 gaim_marshal_POINTER__POINTER_INT64,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6664 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6665 #error Unkown size of time_t
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6666 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6667 gaim_value_new(GAIM_TYPE_POINTER), 2,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6668 gaim_value_new(GAIM_TYPE_SUBTYPE,
14619
6ff3eb035e08 [gaim-migrate @ 17347]
Etan Reisner <pidgin@unreliablesource.net>
parents: 14592
diff changeset
6669 GAIM_SUBTYPE_CONVERSATION),
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6670 #if SIZEOF_TIME_T == 4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6671 gaim_value_new(GAIM_TYPE_INT));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6672 #elif SIZEOF_TIME_T == 8
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6673 gaim_value_new(GAIM_TYPE_INT64));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6674 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6675 # error Unknown size of time_t
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6676 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6677
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6678 gaim_signal_register(handle, "displaying-im-msg",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6679 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6680 gaim_value_new(GAIM_TYPE_BOOLEAN), 5,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6681 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6682 GAIM_SUBTYPE_ACCOUNT),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6683 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6684 gaim_value_new_outgoing(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6685 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6686 GAIM_SUBTYPE_CONVERSATION),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6687 gaim_value_new(GAIM_TYPE_INT));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6688
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6689 gaim_signal_register(handle, "displayed-im-msg",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6690 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6691 NULL, 5,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6692 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6693 GAIM_SUBTYPE_ACCOUNT),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6694 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6695 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6696 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6697 GAIM_SUBTYPE_CONVERSATION),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6698 gaim_value_new(GAIM_TYPE_INT));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6699
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6700 gaim_signal_register(handle, "displaying-chat-msg",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6701 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6702 gaim_value_new(GAIM_TYPE_BOOLEAN), 5,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6703 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6704 GAIM_SUBTYPE_ACCOUNT),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6705 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6706 gaim_value_new_outgoing(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6707 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6708 GAIM_SUBTYPE_CONVERSATION),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6709 gaim_value_new(GAIM_TYPE_INT));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6710
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6711 gaim_signal_register(handle, "displayed-chat-msg",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6712 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6713 NULL, 5,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6714 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6715 GAIM_SUBTYPE_ACCOUNT),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6716 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6717 gaim_value_new(GAIM_TYPE_STRING),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6718 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6719 GAIM_SUBTYPE_CONVERSATION),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6720 gaim_value_new(GAIM_TYPE_INT));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6721
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6722 gaim_signal_register(handle, "conversation-switched",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6723 gaim_marshal_VOID__POINTER_POINTER, NULL, 1,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6724 gaim_value_new(GAIM_TYPE_SUBTYPE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6725 GAIM_SUBTYPE_CONVERSATION));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6727 /**********************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6728 * Register commands
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6729 **********************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6730 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6731 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6732 say_command_cb, _("say &lt;message&gt;: Send a message normally as if you weren't using a command."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6733 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6734 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6735 me_command_cb, _("me &lt;action&gt;: Send an IRC style action to a buddy or chat."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6736 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6737 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6738 debug_command_cb, _("debug &lt;option&gt;: Send various debug information to the current conversation."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6739 gaim_cmd_register("clear", "", GAIM_CMD_P_DEFAULT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6740 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6741 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6742 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6743 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6744 help_command_cb, _("help &lt;command&gt;: Help on a specific command."), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6745
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6746 /**********************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6747 * UI operations
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6748 **********************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6749
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6750 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6751 G_CALLBACK(account_signed_off_cb),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6752 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_ONLINE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6753 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6754 G_CALLBACK(account_signed_off_cb),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6755 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_OFFLINE));
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14668
diff changeset
6756
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6757 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6758 handle, G_CALLBACK(received_im_msg_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6759
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6760 gaim_conversations_set_ui_ops(&conversation_ui_ops);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6761
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6762 hidden_convwin = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6763 window_list = g_list_remove(window_list, hidden_convwin);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6764
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6765 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6766 handle, GAIM_CALLBACK(account_status_changed_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6767
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6768 /* Callbacks to update a conversation */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6769 gaim_signal_connect(blist_handle, "buddy-added", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6770 G_CALLBACK(buddy_update_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6771 gaim_signal_connect(blist_handle, "buddy-removed", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6772 G_CALLBACK(buddy_update_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6773 gaim_signal_connect(blist_handle, "buddy-signed-on",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6774 handle, GAIM_CALLBACK(update_buddy_sign), "on");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6775 gaim_signal_connect(blist_handle, "buddy-signed-off",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6776 handle, GAIM_CALLBACK(update_buddy_sign), "off");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6777 gaim_signal_connect(blist_handle, "buddy-status-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6778 handle, GAIM_CALLBACK(update_buddy_status_changed), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6779 gaim_signal_connect(blist_handle, "buddy-privacy-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6780 handle, GAIM_CALLBACK(update_buddy_privacy_changed), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6781 gaim_signal_connect(blist_handle, "buddy-idle-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6782 handle, GAIM_CALLBACK(update_buddy_idle_changed), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6783 gaim_signal_connect(blist_handle, "buddy-icon-changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6784 handle, GAIM_CALLBACK(update_buddy_icon), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6785 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6786 handle, GAIM_CALLBACK(update_buddy_typing), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6787 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing-stopped",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6788 handle, GAIM_CALLBACK(update_buddy_typing), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6789 gaim_signal_connect(gaim_gtk_conversations_get_handle(), "conversation-switched",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6790 handle, GAIM_CALLBACK(update_conversation_switched), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6791 gaim_signal_connect(gaim_conversations_get_handle(), "chat-left", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6792 GAIM_CALLBACK(update_chat), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6793 gaim_signal_connect(gaim_conversations_get_handle(), "chat-joined", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6794 GAIM_CALLBACK(update_chat), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6795 gaim_signal_connect(gaim_conversations_get_handle(), "chat-topic-changed", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6796 GAIM_CALLBACK(update_chat_topic), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6797 gaim_signal_connect_priority(gaim_conversations_get_handle(), "conversation-updated", handle,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6798 GAIM_CALLBACK(gaim_gtkconv_updated), NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6799 GAIM_SIGNAL_PRIORITY_LOWEST);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6800 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6801
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6802 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6803 gaim_gtk_conversations_uninit(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6804 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6805 gaim_prefs_disconnect_by_handle(gaim_gtk_conversations_get_handle());
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6806 gaim_signals_disconnect_by_handle(gaim_gtk_conversations_get_handle());
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6807 gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle());
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6808 gaim_gtk_conv_window_destroy(hidden_convwin);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6809 hidden_convwin=NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6810 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6811
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6812
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6813
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6814
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6815
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6817
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6818
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6819
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6820
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6821
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6822
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6823
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6824
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6825
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6826
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6827 /* down here is where gtkconvwin.c ought to start. except they share like every freaking function,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6828 * and touch each others' private members all day long */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6829
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6830 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6831 * @file gtkconvwin.c GTK+ Conversation Window API
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6832 * @ingroup gtkui
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6833 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6834 * gaim
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6835 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6836 * Gaim is the legal property of its developers, whose names are too numerous
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6837 * to list here. Please refer to the COPYRIGHT file distributed with this
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6838 * source distribution.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6839 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6840 * This program is free software; you can redistribute it and/or modify
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6841 * it under the terms of the GNU General Public License as published by
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6842 * the Free Software Foundation; either version 2 of the License, or
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6843 * (at your option) any later version.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6844 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6845 * This program is distributed in the hope that it will be useful,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6846 * but WITHOUT ANY WARRANTY; without even the implied warranty of
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6847 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6848 * GNU General Public License for more details.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6849 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6850 * You should have received a copy of the GNU General Public License
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6851 * along with this program; if not, write to the Free Software
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6852 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6853 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6854 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6855 #include "internal.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6856 #include "gtkgaim.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6857
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6858
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6859 #include <gdk/gdkkeysyms.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6860
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6861 #include "account.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6862 #include "cmds.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6863 #include "debug.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6864 #include "imgstore.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6865 #include "log.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6866 #include "notify.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6867 #include "prpl.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6868 #include "request.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6869 #include "util.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6870
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6871 #include "gtkdnd-hints.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6872 #include "gtkblist.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6873 #include "gtkconv.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6874 #include "gtkdialogs.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6875 #include "gtkmenutray.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6876 #include "gtkpounce.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6877 #include "gtkprefs.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6878 #include "gtkprivacy.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6879 #include "gtkutils.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6880 #include "gaimstock.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6881 #include "gtkimhtml.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6882 #include "gtkimhtmltoolbar.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6883
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6884 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6885 do_close(GtkWidget *w, int resp, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6886 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6887 gtk_widget_destroy(warn_close_dialog);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6888 warn_close_dialog = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6889
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6890 if (resp == GTK_RESPONSE_OK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6891 gaim_gtk_conv_window_destroy(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6892 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6893
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6894 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6895 build_warn_close_dialog(GaimGtkWindow *gtkwin)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6896 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6897 GtkWidget *label;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6898 GtkWidget *vbox, *hbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6899 GtkWidget *img;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6900
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6901 g_return_if_fail(warn_close_dialog == NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6902
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6903
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6904 warn_close_dialog = gtk_dialog_new_with_buttons(
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6905 _("Confirm close"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6906 GTK_WINDOW(gtkwin->window), GTK_DIALOG_MODAL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6907 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6908 GAIM_STOCK_CLOSE_TABS, GTK_RESPONSE_OK, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6909
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6910 gtk_dialog_set_default_response(GTK_DIALOG(warn_close_dialog),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6911 GTK_RESPONSE_OK);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6912
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6913 gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6914 6);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6915 gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6916 gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6917 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6918
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6919 /* Setup the outside spacing. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6920 vbox = GTK_DIALOG(warn_close_dialog)->vbox;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6921
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6922 gtk_box_set_spacing(GTK_BOX(vbox), 12);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6923 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6924
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6925 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6926 GTK_ICON_SIZE_DIALOG);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6927 /* Setup the inner hbox and put the dialog's icon in it. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6928 hbox = gtk_hbox_new(FALSE, 12);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6929 gtk_container_add(GTK_CONTAINER(vbox), hbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6930 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6931 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6932
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6933 /* Setup the right vbox. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6934 vbox = gtk_vbox_new(FALSE, 12);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6935 gtk_container_add(GTK_CONTAINER(hbox), vbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6936
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6937 label = gtk_label_new(_("You have unread messages. Are you sure you want to close the window?"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6938 gtk_widget_set_size_request(label, 350, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6939 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6940 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6941 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6943 /* Connect the signals. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6944 g_signal_connect(G_OBJECT(warn_close_dialog), "response",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6945 G_CALLBACK(do_close), gtkwin);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6946
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6947 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6948
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6949 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6950 * Callbacks
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6951 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6952
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6953 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6954 close_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6955 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6956 GaimGtkWindow *win = d;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6957 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6958
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6959 /* If there are unread messages then show a warning dialog */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6960 for (l = gaim_gtk_conv_window_get_gtkconvs(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6961 l != NULL; l = l->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6962 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6963 GaimGtkConversation *gtkconv = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6964 if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6965 gtkconv->unseen_state >= GAIM_UNSEEN_TEXT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6966 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6967 build_warn_close_dialog(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6968 gtk_widget_show_all(warn_close_dialog);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6969
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6970 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6971 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6972 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6973
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6974 gaim_gtk_conv_window_destroy(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6975
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6976 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6977 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6978
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6979 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6980 gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6981 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6982 if (state == GAIM_UNSEEN_NONE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6983 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6984 gtkconv->unseen_count = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6985 gtkconv->unseen_state = GAIM_UNSEEN_NONE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6986 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6987 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6988 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6989 if (state >= GAIM_UNSEEN_TEXT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6990 gtkconv->unseen_count++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6991
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6992 if (state > gtkconv->unseen_state)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6993 gtkconv->unseen_state = state;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6994 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6995
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6996 gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6997 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6998
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6999 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7000 * When a conversation window is focused, we know the user
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7001 * has looked at it so we know there are no longer unseen
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7002 * messages.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7003 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7004 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7005 focus_win_cb(GtkWidget *w, GdkEventFocus *e, gpointer d)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7006 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7007 GaimGtkWindow *win = d;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7008 GaimGtkConversation *gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7009
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7010 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7011
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7012 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7013 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7014
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7015 #if !GTK_CHECK_VERSION(2,6,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7016 /* Courtesy of Galeon! */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7017 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7018 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7019 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7020 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7021 gtk_widget_set_state(widget, GTK_STATE_NORMAL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7022 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7023 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7024
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7025 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7026 notebook_init_grab(GaimGtkWindow *gtkwin, GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7027 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7028 static GdkCursor *cursor = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7029
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7030 gtkwin->in_drag = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7031
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7032 if (gtkwin->drag_leave_signal) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7033 g_signal_handler_disconnect(G_OBJECT(widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7034 gtkwin->drag_leave_signal);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7035 gtkwin->drag_leave_signal = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7036 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7037
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7038 if (cursor == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7039 cursor = gdk_cursor_new(GDK_FLEUR);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7040
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7041 /* Grab the pointer */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7042 gtk_grab_add(gtkwin->notebook);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7043 #ifndef _WIN32
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7044 /* Currently for win32 GTK+ (as of 2.2.1), gdk_pointer_is_grabbed will
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7045 always be true after a button press. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7046 if (!gdk_pointer_is_grabbed())
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7047 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7048 gdk_pointer_grab(gtkwin->notebook->window, FALSE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7049 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7050 NULL, cursor, GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7051 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7053 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7054 notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7055 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7056
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7057 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7058 * Make sure the user moved the mouse far enough for the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7059 * drag to be initiated.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7060 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7061 if (win->in_predrag) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7062 if (e->x_root < win->drag_min_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7063 e->x_root >= win->drag_max_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7064 e->y_root < win->drag_min_y ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7065 e->y_root >= win->drag_max_y) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7066
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7067 win->in_predrag = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7068 notebook_init_grab(win, widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7069 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7070 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7071 else { /* Otherwise, draw the arrows. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7072 GaimGtkWindow *dest_win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7073 GtkNotebook *dest_notebook;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7074 GtkWidget *tab;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7075 gint nb_x, nb_y, page_num;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7076 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7077 gboolean horiz_tabs = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7078 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7079 gboolean to_right = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7080
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7081 /* Get the window that the cursor is over. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7082 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7083
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7084 if (dest_win == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7085 dnd_hints_hide_all();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7086
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7087 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7088 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7089
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7090 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7091
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7092 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7093
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7094 arrow1_x = arrow2_x = nb_x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7095 arrow1_y = arrow2_y = nb_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7096
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7097 page_num = gaim_gtkconv_get_tab_at_xy(dest_win,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7098 e->x_root, e->y_root, &to_right);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7099 to_right = to_right && (win != dest_win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7100
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7101 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7102 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7104 horiz_tabs = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7105 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7106
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7107 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(dest_win, page_num);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7108 tab = gtkconv->tabby;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7109
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7110 if (horiz_tabs) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7111 arrow1_x = arrow2_x = nb_x + tab->allocation.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7112
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7113 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7114 arrow1_x += tab->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7115 arrow2_x += tab->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7116 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7117
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7118 arrow1_y = nb_y + tab->allocation.y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7119 arrow2_y = nb_y + tab->allocation.y + tab->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7120 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7121 arrow1_x = nb_x + tab->allocation.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7122 arrow2_x = nb_x + tab->allocation.x + tab->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7123 arrow1_y = arrow2_y = nb_y + tab->allocation.y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7124
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7125 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7126 arrow1_y += tab->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7127 arrow2_y += tab->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7128 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7129 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7130
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7131 if (horiz_tabs) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7132 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7133 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7134 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7135 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7136 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7137 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7138 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7139
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7140 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7141 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7142
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7143 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7144 notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7145 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7146 if (win->in_drag)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7147 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7148
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7149 if (e->x_root < win->drag_min_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7150 e->x_root >= win->drag_max_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7151 e->y_root < win->drag_min_y ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7152 e->y_root >= win->drag_max_y) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7153
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7154 win->in_predrag = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7155 notebook_init_grab(win, widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7156 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7157
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7158 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7159 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7160
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7161 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7162 * THANK YOU GALEON!
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7163 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7164 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7165 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7166 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7167 gint nb_x, nb_y, x_rel, y_rel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7168 int tab_clicked;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7169 GtkWidget *page;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7170 GtkWidget *tab;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7171
14721
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7172 if (e->button == 2) {
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7173 GaimGtkConversation *gtkconv;
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7174 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7175
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7176 if (tab_clicked == -1)
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7177 return FALSE;
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7178
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7179 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, tab_clicked);
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7180 close_conv_cb(NULL, gtkconv);
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7181 return TRUE;
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7182 }
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7183
90882b641dda [gaim-migrate @ 17475]
Sean Egan <seanegan@gmail.com>
parents: 14701
diff changeset
7184
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7185 if (e->button != 1 || e->type != GDK_BUTTON_PRESS)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7186 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7187
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7189 if (win->in_drag) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7190 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7191 "Already in the middle of a window drag at tab_press_cb\n");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7192 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7193 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7194
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7195 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7196 * Make sure a tab was actually clicked. The arrow buttons
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7197 * mess things up.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7198 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7199 tab_clicked = gaim_gtkconv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7200
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7201 if (tab_clicked == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7202 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7203
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7204 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7205 * Get the relative position of the press event, with regards to
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7206 * the position of the notebook.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7207 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7208 gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7209
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7210 x_rel = e->x_root - nb_x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7211 y_rel = e->y_root - nb_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7212
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7213 /* Reset the min/max x/y */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7214 win->drag_min_x = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7215 win->drag_min_y = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7216 win->drag_max_x = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7217 win->drag_max_y = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7218
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7219 /* Find out which tab was dragged. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7220 page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7221 tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7222
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7223 win->drag_min_x = tab->allocation.x + nb_x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7224 win->drag_min_y = tab->allocation.y + nb_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7225 win->drag_max_x = tab->allocation.width + win->drag_min_x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7226 win->drag_max_y = tab->allocation.height + win->drag_min_y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7227
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7228 /* Make sure the click occurred in the tab. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7229 if (e->x_root < win->drag_min_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7230 e->x_root >= win->drag_max_x ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7231 e->y_root < win->drag_min_y ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7232 e->y_root >= win->drag_max_y) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7233
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7234 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7235 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7236
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7237 win->in_predrag = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7238 win->drag_tab = tab_clicked;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7240 /* Connect the new motion signals. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7241 win->drag_motion_signal =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7242 g_signal_connect(G_OBJECT(widget), "motion_notify_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7243 G_CALLBACK(notebook_motion_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7244
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7245 win->drag_leave_signal =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7246 g_signal_connect(G_OBJECT(widget), "leave_notify_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7247 G_CALLBACK(notebook_leave_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7248
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7249 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7250 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7251
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7252 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7253 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7254 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7255 GaimGtkWindow *dest_win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7256 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7257 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7258 gint dest_page_num = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7259 gboolean new_window = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7260 gboolean to_right = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7261
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7262 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7263 * Don't check to make sure that the event's window matches the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7264 * widget's, because we may be getting an event passed on from the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7265 * close button.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7266 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7267 if (e->button != 1 && e->type != GDK_BUTTON_RELEASE)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7268 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7269
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7270 if (gdk_pointer_is_grabbed()) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7271 gdk_pointer_ungrab(GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7272 gtk_grab_remove(widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7273 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7274
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7275 if (!win->in_predrag && !win->in_drag)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7276 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7277
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7278 /* Disconnect the motion signal. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7279 if (win->drag_motion_signal) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7280 g_signal_handler_disconnect(G_OBJECT(widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7281 win->drag_motion_signal);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7282
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7283 win->drag_motion_signal = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7284 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7285
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7286 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7287 * If we're in a pre-drag, we'll also need to disconnect the leave
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7288 * signal.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7289 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7290 if (win->in_predrag) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7291 win->in_predrag = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7292
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7293 if (win->drag_leave_signal) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7294 g_signal_handler_disconnect(G_OBJECT(widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7295 win->drag_leave_signal);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7296
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7297 win->drag_leave_signal = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7298 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7299 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7300
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7301 /* If we're not in drag... */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7302 /* We're perfectly normal people! */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7303 if (!win->in_drag)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7304 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7305
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7306 win->in_drag = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7307
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7308 dnd_hints_hide_all();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7309
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7310 dest_win = gaim_gtk_conv_window_get_at_xy(e->x_root, e->y_root);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7311
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7312 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7313
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7314 if (dest_win == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7315 /* If the current window doesn't have any other conversations,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7316 * there isn't much point transferring the conv to a new window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7317 if (gaim_gtk_conv_window_get_gtkconv_count(win) > 1) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7318 /* Make a new window to stick this to. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7319 dest_win = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7320 new_window = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7321 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7322 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7323
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7324 if (dest_win == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7325 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7326
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7327 gaim_signal_emit(gaim_gtk_conversations_get_handle(),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7328 "conversation-dragging", win, dest_win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7330 /* Get the destination page number. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7331 if (!new_window)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7332 dest_page_num = gaim_gtkconv_get_tab_at_xy(dest_win,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7333 e->x_root, e->y_root, &to_right);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7334
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7335 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7336
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7337 if (win == dest_win) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7338 gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7339 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7340 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7341 gaim_gtk_conv_window_add_gtkconv(dest_win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7342 gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7343 gaim_gtk_conv_window_switch_gtkconv(dest_win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7344 if (new_window) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7345 gint win_width, win_height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7346
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7347 gtk_window_get_size(GTK_WINDOW(dest_win->window),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7348 &win_width, &win_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7349
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7350 gtk_window_move(GTK_WINDOW(dest_win->window),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7351 e->x_root - (win_width / 2),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7352 e->y_root - (win_height / 2));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7353
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7354 gaim_gtk_conv_window_show(dest_win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7355 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7356 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7357
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7358 gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7359
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7360 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7361 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7362
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7363
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7364 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7365 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7366 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7367 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7368 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7369 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7370 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7372 win = user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7373 conv = gaim_gtk_conv_window_get_active_conversation(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7375 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7376
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7377 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7378 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7379
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7380 gtkconv = GAIM_GTK_CONVERSATION(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7381
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7382 stop_anim(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7383 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7384 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7385 close_window(GtkWidget *w, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7386 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7387 close_win_cb(w, NULL, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7388 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7389
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7390 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7391 detach_tab_cb(GtkWidget *w, GObject *menu)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7392 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7393 GaimGtkWindow *win, *new_window;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7394 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7395
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7396 gtkconv = g_object_get_data(menu, "clicked_tab");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7397
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7398 if (!gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7399 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7400
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7401 win = gaim_gtkconv_get_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7402 /* Nothing to do if there's only one tab in the window */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7403 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7404 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7405
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7406 gaim_gtk_conv_window_remove_gtkconv(win, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7407
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7408 new_window = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7409 gaim_gtk_conv_window_add_gtkconv(new_window, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7410 gaim_gtk_conv_window_show(new_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7411 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7412
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7413 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7414 close_others_cb(GtkWidget *w, GObject *menu)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7415 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7416 GList *iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7417 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7418 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7419
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7420 gtkconv = g_object_get_data(menu, "clicked_tab");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7421
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7422 if (!gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7423 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7424
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7425 win = gaim_gtkconv_get_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7426
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7427 for (iter = gaim_gtk_conv_window_get_gtkconvs(win); iter; )
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7428 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7429 GaimGtkConversation *gconv = iter->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7430 iter = iter->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7431
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7432 if (gconv != gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7433 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7434 close_conv_cb(NULL, gconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7435 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7436 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7437 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7438
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7439 static void close_tab_cb(GtkWidget *w, GObject *menu)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7440 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7441 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7442
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7443 gtkconv = g_object_get_data(menu, "clicked_tab");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7444
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7445 if (gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7446 close_conv_cb(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7447 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7448
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7449 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7450 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7451 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7452 GtkWidget *item, *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7453 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7454
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7455 if (event->type != GDK_BUTTON_PRESS || event->button != 3)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7456 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7457
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7458 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7459 gaim_gtkconv_get_tab_at_xy(win, event->x_root, event->y_root, NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7460
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7461 if (g_object_get_data(G_OBJECT(notebook->menu), "clicked_tab"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7462 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7463 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7464 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7465 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7466
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7467 g_object_set_data(G_OBJECT(notebook->menu), "clicked_tab", gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7468
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7469 menu = notebook->menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7470 gaim_separator(GTK_WIDGET(menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7471
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7472 item = gtk_menu_item_new_with_label(_("Close other tabs"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7473 gtk_widget_show(item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7474 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7475 g_signal_connect(G_OBJECT(item), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7476 G_CALLBACK(close_others_cb), menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7477
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7478 item = gtk_menu_item_new_with_label(_("Close all tabs"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7479 gtk_widget_show(item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7480 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7481 g_signal_connect(G_OBJECT(item), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7482 G_CALLBACK(close_window), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7483
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7484 gaim_separator(menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7485
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7486 item = gtk_menu_item_new_with_label(_("Detach this tab"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7487 gtk_widget_show(item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7488 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7489 g_signal_connect(G_OBJECT(item), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7490 G_CALLBACK(detach_tab_cb), menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7491
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7492 item = gtk_menu_item_new_with_label(_("Close this tab"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7493 gtk_widget_show(item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7494 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7495 g_signal_connect(G_OBJECT(item), "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7496 G_CALLBACK(close_tab_cb), menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7497
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7498 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7499 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7500
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7501 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7502 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7503 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7504 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7505 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7506 GaimConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7507 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7508 const char *sound_method;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7509
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7510 win = user_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7511 gtkconv = gaim_gtk_conv_window_get_gtkconv_at_index(win, page_num);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7512 conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7513
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7514 g_return_if_fail(conv != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7515
14332
af0d0e23b937 [gaim-migrate @ 17028]
Aaron Sheldon <aaronsheldon>
parents: 14228
diff changeset
7516 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7517
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7518 /* Update the menubar */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7519
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7520 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7521 gaim_conversation_is_logging(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7522
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7523 generate_send_to_items(win);
14853
910e783fbbc7 [gaim-migrate @ 17622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14852
diff changeset
7524 regenerate_options_items(win);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7525
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7526 gaim_gtkconv_switch_active_conversation(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7527
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7528 sound_method = gaim_prefs_get_string("/gaim/gtk/sound/method");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7529 if (strcmp(sound_method, "none") != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7530 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7531 gtkconv->make_sound);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7532
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7533 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7534 gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7535
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7536 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7537 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7538
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7539 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7540 gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7541 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7542 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7543 gtkconv->u.im->show_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7544 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7545
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7546 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7547 * We pause icons when they are not visible. If this icon should
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7548 * be animated then start it back up again.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7549 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7550 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7551 (gtkconv->u.im->animate))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7552 start_anim(NULL, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7553
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7554 gaim_signal_emit(gaim_gtk_conversations_get_handle(), "conversation-switched", conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7555 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7556
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7557 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7558 * GTK+ window ops
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7559 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7561 GList *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7562 gaim_gtk_conv_windows_get_list()
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7563 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7564 return window_list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7565 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7566
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7567 GaimGtkWindow *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7568 gaim_gtk_conv_window_new()
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7569 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7570 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7571 GtkPositionType pos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7572 GtkWidget *testidea;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7573 GtkWidget *menubar;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7574
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7575 win = g_malloc0(sizeof(GaimGtkWindow));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7576
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7577 window_list = g_list_append(window_list, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7578
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7579 /* Create the window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7580 win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7581 gtk_window_set_role(GTK_WINDOW(win->window), "conversation");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7582 gtk_window_set_resizable(GTK_WINDOW(win->window), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7583 gtk_container_set_border_width(GTK_CONTAINER(win->window), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7584 GTK_WINDOW(win->window)->allow_shrink = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7585
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7586 g_signal_connect(G_OBJECT(win->window), "delete_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7587 G_CALLBACK(close_win_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7588
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7589 g_signal_connect(G_OBJECT(win->window), "focus_in_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7590 G_CALLBACK(focus_win_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7591
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7592 /* Create the notebook. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7593 win->notebook = gtk_notebook_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7594
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7595 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7596
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7597 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7598 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(win->notebook), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7599 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(win->notebook), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7600 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7601 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7602 gtk_notebook_set_scrollable(GTK_NOTEBOOK(win->notebook), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7603 gtk_notebook_popup_enable(GTK_NOTEBOOK(win->notebook));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7604 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7605 gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7606
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7607 g_signal_connect(G_OBJECT(win->notebook), "button-press-event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7608 G_CALLBACK(right_click_menu_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7609
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7610 gtk_widget_show(win->notebook);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7611
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7612 g_signal_connect(G_OBJECT(win->notebook), "switch_page",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7613 G_CALLBACK(before_switch_conv_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7614 g_signal_connect_after(G_OBJECT(win->notebook), "switch_page",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7615 G_CALLBACK(switch_conv_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7616
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7617 /* Setup the tab drag and drop signals. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7618 gtk_widget_add_events(win->notebook,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7619 GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7620 g_signal_connect(G_OBJECT(win->notebook), "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7621 G_CALLBACK(notebook_press_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7622 g_signal_connect(G_OBJECT(win->notebook), "button_release_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7623 G_CALLBACK(notebook_release_cb), win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7624
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7625 testidea = gtk_vbox_new(FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7626
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7627 /* Setup the menubar. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7628 menubar = setup_menubar(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7629 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7630
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7631 gtk_box_pack_start(GTK_BOX(testidea), win->notebook, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7632
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7633 gtk_container_add(GTK_CONTAINER(win->window), testidea);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7634
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7635 gtk_widget_show(testidea);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7636
14574
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14520
diff changeset
7637 #ifdef _WIN32
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14520
diff changeset
7638 g_signal_connect(G_OBJECT(win->window), "show",
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14520
diff changeset
7639 G_CALLBACK(gtkwgaim_ensure_onscreen), win->window);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14520
diff changeset
7640 #endif
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14520
diff changeset
7641
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7642 return win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7643 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7644
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7645 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7646 gaim_gtk_conv_window_destroy(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7647 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7648 gaim_prefs_disconnect_by_handle(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7649 window_list = g_list_remove(window_list, win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7650
14370
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
7651 /* Close the "Find" dialog if it's open */
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
7652 if (win->dialogs.search)
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
7653 gtk_widget_destroy(win->dialogs.search);
c2fe0f54c389 [gaim-migrate @ 17076]
Richard Laager <rlaager@wiktel.com>
parents: 14332
diff changeset
7654
14668
79c1c4fe497d [gaim-migrate @ 17414]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14619
diff changeset
7655 gtk_widget_hide_all(win->window);
79c1c4fe497d [gaim-migrate @ 17414]
Stu Tomlinson <stu@nosnilmot.com>
parents: 14619
diff changeset
7656
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7657 if (win->gtkconvs) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7658 while (win->gtkconvs) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7659 GList *nextgtk = win->gtkconvs->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7660 GaimGtkConversation *gtkconv = win->gtkconvs->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7661 GList *nextcore = gtkconv->convs->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7662 GaimConversation *conv = gtkconv->convs->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7663 gaim_conversation_destroy(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7664 if (!nextgtk && !nextcore)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7665 /* we'll end up invoking ourselves when we destroy our last child */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7666 /* so don't destroy ourselves right now */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7667 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7668 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7669 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7670 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7671 gtk_widget_destroy(win->window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7672
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7673 g_object_unref(G_OBJECT(win->menu.item_factory));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7675 gaim_notify_close_with_handle(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7676
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7677 g_free(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7678 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7679
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7680 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7681 gaim_gtk_conv_window_show(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7682 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7683 gtk_widget_show(win->window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7684 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7685
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7686 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7687 gaim_gtk_conv_window_hide(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7688 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7689 gtk_widget_hide(win->window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7690 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7691
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7692 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7693 gaim_gtk_conv_window_raise(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7694 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7695 gdk_window_raise(GDK_WINDOW(win->window->window));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7696 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7697
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7698 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7699 gaim_gtk_conv_window_switch_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7700 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7701 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7702 gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7703 gtkconv->tab_cont));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7704 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7705
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7706 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7707 gaim_gtk_conv_window_add_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7708 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7709 GaimConversation *conv = gtkconv->active_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7710 GaimGtkConversation *focus_gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7711 GtkWidget *tabby, *menu_tabby;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7712 GtkWidget *tab_cont = gtkconv->tab_cont;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7713 GtkWidget *close_image;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7714 GaimConversationType conv_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7715 const gchar *tmp_lab;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7716 gint close_button_width, close_button_height, focus_width, focus_pad;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7717 gboolean tabs_side = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7718 gint angle = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7719
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7720 conv_type = gaim_conversation_get_type(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7721
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7722
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7723 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7724 gtkconv->win = win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7725
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7726 if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_LEFT ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7727 gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_RIGHT)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7728 tabs_side = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7729 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_LEFT|8))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7730 angle = 90;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7731 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_RIGHT|8))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7732 angle = 270;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7733
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7734 if (angle)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7735 gtkconv->tabby = tabby = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7736 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7737 gtkconv->tabby = tabby = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7738 gtkconv->menu_tabby = menu_tabby = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7739
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7740 /* Close button. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7741 gtkconv->close = gtk_button_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7742 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &close_button_width, &close_button_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7743 if (gtk_check_version(2, 4, 2) == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7744 /* Need to account for extra padding around the gtkbutton */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7745 gtk_widget_style_get(GTK_WIDGET(gtkconv->close),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7746 "focus-line-width", &focus_width,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7747 "focus-padding", &focus_pad,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7748 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7749 close_button_width += (focus_width + focus_pad) * 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7750 close_button_height += (focus_width + focus_pad) * 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7751 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7752 gtk_widget_set_size_request(GTK_WIDGET(gtkconv->close),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7753 close_button_width, close_button_height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7754
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7755 gtk_button_set_relief(GTK_BUTTON(gtkconv->close), GTK_RELIEF_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7756 close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7757 gtk_widget_show(close_image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7758 gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7759 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7760 _("Close conversation"), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7761
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7762 g_signal_connect(G_OBJECT(gtkconv->close), "clicked",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7763 G_CALLBACK(close_conv_cb), gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7764
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7765 #if !GTK_CHECK_VERSION(2,6,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7766 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7767 * I love Galeon. They have a fix for that stupid annoying visible
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7768 * border bug. I love you guys! -- ChipX86
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7769 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7770 /* This is fixed properly in some version of Gtk before 2.6.0 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7771 g_signal_connect(G_OBJECT(gtkconv->close), "state_changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7772 G_CALLBACK(tab_close_button_state_changed_cb), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7773 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7774
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7775 /* Status icon. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7776 gtkconv->icon = gtk_image_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7777 gtkconv->menu_icon = gtk_image_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7778 update_tab_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7779
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7780 /* Tab label. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7781 gtkconv->tab_label = gtk_label_new(tmp_lab = gaim_conversation_get_title(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7782
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7783 #if GTK_CHECK_VERSION(2,6,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7784 if (!angle)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7785 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7786 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7787 if (tabs_side) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7788 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), MIN(g_utf8_strlen(tmp_lab, -1), 12));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7789 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7790 if (angle)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7791 gtk_label_set_angle(GTK_LABEL(gtkconv->tab_label), angle);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7792 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7793 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7794 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7795 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7796 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7797 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7798
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7799 /* Pack it all together. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7800 if (angle == 90)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7801 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7802 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7803 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7804 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_icon,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7805 FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7806
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7807 gtk_widget_show_all(gtkconv->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7808 gtk_widget_show_all(gtkconv->menu_icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7809
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7810 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7811 gtk_box_pack_start(GTK_BOX(menu_tabby), gtkconv->menu_label, TRUE, TRUE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7812 gtk_widget_show(gtkconv->tab_label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7813 gtk_widget_show(gtkconv->menu_label);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7814 gtk_misc_set_alignment(GTK_MISC(gtkconv->menu_label), 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7815
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7816 if (angle == 90)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7817 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7818 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7819 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7820 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7821 gtk_widget_show(gtkconv->close);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7822
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7823 gtk_widget_show(tabby);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7824 gtk_widget_show(menu_tabby);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7825
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7826 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7827 gaim_gtkconv_update_buddy_icon(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7828
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7829 /* Add this pane to the conversation's notebook. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7830 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7831 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7832
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7833
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7834 gtk_widget_show(tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7835
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7836 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7837 /* Er, bug in notebooks? Switch to the page manually. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7838 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7839
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7840 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7841 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7842 } else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7843 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7844
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7845 focus_gtkconv = g_list_nth_data(gaim_gtk_conv_window_get_gtkconvs(win),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7846 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7847 gtk_widget_grab_focus(focus_gtkconv->entry);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7848
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7849 if (gaim_gtk_conv_window_get_gtkconv_count(win) == 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7850 update_send_to_selection(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7851 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7852
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7853 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7854 gaim_gtk_conv_window_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7855 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7856 unsigned int index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7857 GaimConversationType conv_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7858
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7859 conv_type = gaim_conversation_get_type(gtkconv->active_conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7860 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7861
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7862 g_object_ref(gtkconv->tab_cont);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7863 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7864
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7865 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7866
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7867 /* go back to tabless if need be */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7868 if (gaim_gtk_conv_window_get_gtkconv_count(win) <= 2) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7869 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7870 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7871 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7872
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7873 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7874
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7875 if (!win->gtkconvs && win != hidden_convwin)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7876 gaim_gtk_conv_window_destroy(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7877 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7878
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7879 GaimGtkConversation *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7880 gaim_gtk_conv_window_get_gtkconv_at_index(const GaimGtkWindow *win, int index)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7881 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7882 GtkWidget *tab_cont;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7883
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7884 if (index == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7885 index = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7886 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7887 return tab_cont ? g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation") : NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7888 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7889
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7890 GaimGtkConversation *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7891 gaim_gtk_conv_window_get_active_gtkconv(const GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7892 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7893 int index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7894 GtkWidget *tab_cont;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7895
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7896 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7897 if (index == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7898 index = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7899 tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7900 if (!tab_cont)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7901 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7902 return g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7903 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7904
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7905
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7906 GaimConversation *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7907 gaim_gtk_conv_window_get_active_conversation(const GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7908 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7909 GaimGtkConversation *gtkconv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7910
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7911 gtkconv = gaim_gtk_conv_window_get_active_gtkconv(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7912 return gtkconv ? gtkconv->active_conv : NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7913 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7914
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7915 gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7916 gaim_gtk_conv_window_is_active_conversation(const GaimConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7917 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7918 return conv == gaim_gtk_conv_window_get_active_conversation(GAIM_GTK_CONVERSATION(conv)->win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7919 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7920
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7921 gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7922 gaim_gtk_conv_window_has_focus(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7923 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7924 gboolean has_focus = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7925
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7926 g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7927
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7928 return has_focus;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7929 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7930
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7931 GaimGtkWindow *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7932 gaim_gtk_conv_window_get_at_xy(int x, int y)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7933 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7934 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7935 GdkWindow *gdkwin;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7936 GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7937
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7938 gdkwin = gdk_window_at_pointer(&x, &y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7939
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7940 if (gdkwin)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7941 gdkwin = gdk_window_get_toplevel(gdkwin);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7943 for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7944 win = l->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7945
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7946 if (gdkwin == win->window->window)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7947 return win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7948 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7949
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7950 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7951 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7952
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7953 GList *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7954 gaim_gtk_conv_window_get_gtkconvs(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7955 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7956 return win->gtkconvs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7957 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7958
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7959 guint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7960 gaim_gtk_conv_window_get_gtkconv_count(GaimGtkWindow *win)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7961 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7962 return g_list_length(win->gtkconvs);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7963 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7964
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7965 GaimGtkWindow *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7966 gaim_gtk_conv_window_first_with_type(GaimConversationType type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7967 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7968 GList *wins, *convs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7969 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7970 GaimGtkConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7971
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7972 if (type == GAIM_CONV_TYPE_UNKNOWN)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7973 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7974
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7975 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7976 win = wins->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7977
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7978 for (convs = win->gtkconvs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7979 convs != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7980 convs = convs->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7981
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7982 conv = convs->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7983
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7984 if (gaim_conversation_get_type(conv->active_conv) == type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7985 return win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7986 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7987 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7988
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7989 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7990 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7991
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7992 GaimGtkWindow *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7993 gaim_gtk_conv_window_last_with_type(GaimConversationType type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7994 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7995 GList *wins, *convs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7996 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7997 GaimGtkConversation *conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7998
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7999 if (type == GAIM_CONV_TYPE_UNKNOWN)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8000 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8001
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8002 for (wins = g_list_last(gaim_gtk_conv_windows_get_list());
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8003 wins != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8004 wins = wins->prev) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8005
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8006 win = wins->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8007
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8008 for (convs = win->gtkconvs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8009 convs != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8010 convs = convs->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8011
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8012 conv = convs->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8013
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8014 if (gaim_conversation_get_type(conv->active_conv) == type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8015 return win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8016 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8017 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8018
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8019 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8020 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8021
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8022
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8023 /**************************************************************************
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8024 * Conversation placement functions
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8025 **************************************************************************/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8026 typedef struct
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8027 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8028 char *id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8029 char *name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8030 GaimConvPlacementFunc fnc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8031
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8032 } ConvPlacementData;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8033
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8034 static GList *conv_placement_fncs = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8035 static GaimConvPlacementFunc place_conv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8036
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8037 /* This one places conversations in the last made window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8038 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8039 conv_placement_last_created_win(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8040 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8041 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8042
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8043 GList *l = g_list_last(gaim_gtk_conv_windows_get_list());
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8044 win = l ? l->data : NULL;;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8045
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8046 if (win == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8047 win = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8048
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8049 gaim_gtk_conv_window_add_gtkconv(win, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8050 gaim_gtk_conv_window_show(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8051 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8052 gaim_gtk_conv_window_add_gtkconv(win, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8053 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8054 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8055
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8056 /* This one places conversations in the last made window of the same type. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8057 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8058 conv_placement_last_created_win_type(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8059 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8060 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8061
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8062 win = gaim_gtk_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8063
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8064 if (win == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8065 win = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8066
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8067 gaim_gtk_conv_window_add_gtkconv(win, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8068 gaim_gtk_conv_window_show(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8069 } else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8070 gaim_gtk_conv_window_add_gtkconv(win, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8071 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8072
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8073 /* This one places each conversation in its own window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8074 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8075 conv_placement_new_window(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8076 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8077 GaimGtkWindow *win;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8078
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8079 win = gaim_gtk_conv_window_new();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8080
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8081 gaim_gtk_conv_window_add_gtkconv(win, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8082
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8083 gaim_gtk_conv_window_show(win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8084 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8085
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8086 static GaimGroup *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8087 conv_get_group(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8088 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8089 GaimGroup *group = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8090
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8091 if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_IM) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8092 GaimBuddy *buddy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8093
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8094 buddy = gaim_find_buddy(gaim_conversation_get_account(conv->active_conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8095 gaim_conversation_get_name(conv->active_conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8096
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8097 if (buddy != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8098 group = gaim_buddy_get_group(buddy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8099
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8100 } else if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_CHAT) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8101 GaimChat *chat;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8102
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8103 chat = gaim_blist_find_chat(gaim_conversation_get_account(conv->active_conv),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8104 gaim_conversation_get_name(conv->active_conv));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8106 if (chat != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8107 group = gaim_chat_get_group(chat);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8108 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8109
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8110 return group;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8111 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8112
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8113 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8114 * This groups things by, well, group. Buddies from groups will always be
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8115 * grouped together, and a buddy from a group not belonging to any currently
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8116 * open windows will get a new window.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8117 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8118 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8119 conv_placement_by_group(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8120 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8121 GaimConversationType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8122 GaimGroup *group = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8123 GList *wl, *cl;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8124
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8125 type = gaim_conversation_get_type(conv->active_conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8126
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8127 group = conv_get_group(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8128
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8129 /* Go through the list of IMs and find one with this group. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8130 for (wl = gaim_gtk_conv_windows_get_list(); wl != NULL; wl = wl->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8131 GaimGtkWindow *win2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8132 GaimGtkConversation *conv2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8133 GaimGroup *group2 = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8134
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8135 win2 = wl->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8136
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8137 for (cl = win2->gtkconvs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8138 cl != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8139 cl = cl->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8140 conv2 = cl->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8141
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8142 group2 = conv_get_group(conv2);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8143
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8144 if (group == group2) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8145 gaim_gtk_conv_window_add_gtkconv(win2, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8146
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8147 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8148 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8149 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8150 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8151
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8152 /* Make a new window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8153 conv_placement_new_window(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8154 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8155
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8156 /* This groups things by account. Otherwise, the same semantics as above */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8157 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8158 conv_placement_by_account(GaimGtkConversation *conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8159 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8160 GaimConversationType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8161 GList *wins, *convs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8162 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8163
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8164 account = gaim_conversation_get_account(conv->active_conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8165 type = gaim_conversation_get_type(conv->active_conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8166
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8167 /* Go through the list of IMs and find one with this group. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8168 for (wins = gaim_gtk_conv_windows_get_list(); wins != NULL; wins = wins->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8169 GaimGtkWindow *win2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8170 GaimGtkConversation *conv2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8171
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8172 win2 = wins->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8173
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8174 for (convs = win2->gtkconvs;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8175 convs != NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8176 convs = convs->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8177 conv2 = convs->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8178
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8179 if (account == gaim_conversation_get_account(conv2->active_conv)) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8180 gaim_gtk_conv_window_add_gtkconv(win2, conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8181 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8182 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8183 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8184 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8186 /* Make a new window. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8187 conv_placement_new_window(conv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8188 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8189
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8190 static ConvPlacementData *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8191 get_conv_placement_data(const char *id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8192 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8193 ConvPlacementData *data = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8194 GList *n;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8195
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8196 for (n = conv_placement_fncs; n; n = n->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8197 data = n->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8198 if (!strcmp(data->id, id))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8199 return data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8200 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8201
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8202 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8203 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8205 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8206 add_conv_placement_fnc(const char *id, const char *name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8207 GaimConvPlacementFunc fnc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8208 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8209 ConvPlacementData *data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8210
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8211 data = g_new(ConvPlacementData, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8212
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8213 data->id = g_strdup(id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8214 data->name = g_strdup(name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8215 data->fnc = fnc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8216
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8217 conv_placement_fncs = g_list_append(conv_placement_fncs, data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8218 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8219
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8220 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8221 ensure_default_funcs(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8222 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8223 if (conv_placement_fncs == NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8224 add_conv_placement_fnc("last", _("Last created window"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8225 conv_placement_last_created_win);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8226 add_conv_placement_fnc("im_chat", _("Separate IM and Chat windows"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8227 conv_placement_last_created_win_type);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8228 add_conv_placement_fnc("new", _("New window"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8229 conv_placement_new_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8230 add_conv_placement_fnc("group", _("By group"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8231 conv_placement_by_group);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8232 add_conv_placement_fnc("account", _("By account"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8233 conv_placement_by_account);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8234 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8235 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8236
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8237 GList *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8238 gaim_gtkconv_placement_get_options(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8239 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8240 GList *n, *list = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8241 ConvPlacementData *data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8242
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8243 ensure_default_funcs();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8244
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8245 for (n = conv_placement_fncs; n; n = n->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8246 data = n->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8247 list = g_list_append(list, data->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8248 list = g_list_append(list, data->id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8249 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8250
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8251 return list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8252 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8254
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8255 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8256 gaim_gtkconv_placement_add_fnc(const char *id, const char *name,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8257 GaimConvPlacementFunc fnc)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8258 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8259 g_return_if_fail(id != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8260 g_return_if_fail(name != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8261 g_return_if_fail(fnc != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8262
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8263 ensure_default_funcs();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8264
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8265 add_conv_placement_fnc(id, name, fnc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8266 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8267
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8268 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8269 gaim_gtkconv_placement_remove_fnc(const char *id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8270 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8271 ConvPlacementData *data = get_conv_placement_data(id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8272
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8273 if (data == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8274 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8275
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8276 conv_placement_fncs = g_list_remove(conv_placement_fncs, data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8277
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8278 g_free(data->id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8279 g_free(data->name);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8280 g_free(data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8281 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8282
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8283 const char *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8284 gaim_gtkconv_placement_get_name(const char *id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8285 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8286 ConvPlacementData *data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8287
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8288 ensure_default_funcs();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8289
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8290 data = get_conv_placement_data(id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8291
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8292 if (data == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8293 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8294
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8295 return data->name;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8296 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8297
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8298 GaimConvPlacementFunc
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8299 gaim_gtkconv_placement_get_fnc(const char *id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8300 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8301 ConvPlacementData *data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8302
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8303 ensure_default_funcs();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8304
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8305 data = get_conv_placement_data(id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8306
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8307 if (data == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8308 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8309
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8310 return data->fnc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8311 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8312
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8313 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8314 gaim_gtkconv_placement_set_current_func(GaimConvPlacementFunc func)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8315 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8316 g_return_if_fail(func != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8317
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8318 /* If tabs are enabled, set the function, otherwise, NULL it out. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8319 if (gaim_prefs_get_bool("/gaim/gtk/conversations/tabs"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8320 place_conv = func;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8321 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8322 place_conv = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8323 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8324
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8325 GaimConvPlacementFunc
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8326 gaim_gtkconv_placement_get_current_func(void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8327 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8328 return place_conv;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8329 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8330
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8331 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8332 gaim_gtkconv_placement_place(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8333 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8334 if (place_conv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8335 place_conv(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8336 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8337 conv_placement_new_window(gtkconv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8338 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8339
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8340 gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8341 gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8342 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8343 g_return_val_if_fail(gtkconv != NULL, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8344
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8345 return (gtkconv->win == hidden_convwin);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8346 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8347
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8348
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8349 /* Algorithm from http://www.w3.org/TR/AERT#color-contrast */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8350 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8351 color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8352 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8353 gulong fg_brightness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8354 gulong bg_brightness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8355 gulong br_diff;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8356 gulong col_diff;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8357 int fred, fgreen, fblue, bred, bgreen, bblue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8358
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8359 /* this algorithm expects colors between 0 and 255 for each of red green and blue.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8360 * GTK on the other hand has values between 0 and 65535
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8361 * Err suggested I >> 8, which grabbed the high bits.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8362 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8363
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8364 fred = foreground.red >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8365 fgreen = foreground.green >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8366 fblue = foreground.blue >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8367
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8368
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8369 bred = background.red >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8370 bgreen = background.green >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8371 bblue = background.blue >> 8 ;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8372
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8373 fg_brightness = (fred * 299 + fgreen * 587 + fblue * 114) / 1000;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8374 bg_brightness = (bred * 299 + bgreen * 587 + bblue * 114) / 1000;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8375 br_diff = abs(fg_brightness - bg_brightness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8376
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8377 col_diff = abs(fred - bred) + abs(fgreen - bgreen) + abs(fblue - bblue);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8378
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8379 return ((col_diff > color_contrast) && (br_diff > brightness_contrast));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8380 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8381
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8382
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8383 static GdkColor*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8384 generate_nick_colors(guint *color_count, GdkColor background)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8385 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8386 guint numcolors = *color_count;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8387 guint i = 0, j = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8388 GdkColor *colors = g_new(GdkColor, numcolors);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8389 GdkColor nick_highlight;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8390 GdkColor send_color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8391 time_t breakout_time;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8392
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8393 gdk_color_parse(HIGHLIGHT_COLOR, &nick_highlight);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8394 gdk_color_parse(SEND_COLOR, &send_color);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8395
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8396 srand(background.red + background.green + background.blue + 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8397
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8398 breakout_time = time(NULL) + 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8399
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8400 /* first we look through the list of "good" colors: colors that differ from every other color in the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8401 * list. only some of them will differ from the background color though. lets see if we can find
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8402 * numcolors of them that do
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8403 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8404 while (i < numcolors && j < NUM_NICK_SEED_COLORS && time(NULL) < breakout_time)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8405 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8406 GdkColor color = nick_seed_colors[j];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8407
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8408 if (color_is_visible(color, background, MIN_COLOR_CONTRAST, MIN_BRIGHTNESS_CONTRAST) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8409 color_is_visible(color, nick_highlight, MIN_COLOR_CONTRAST / 2, 0) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8410 color_is_visible(color, send_color, MIN_COLOR_CONTRAST / 4, 0))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8411 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8412 colors[i] = color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8413 i++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8414 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8415 j++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8416 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8417
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8418 /* we might not have found numcolors in the last loop. if we did, we'll never enter this one.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8419 * if we did not, lets just find some colors that don't conflict with the background. its
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8420 * expensive to find colors that not only don't conflict with the background, but also do not
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8421 * conflict with each other.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8422 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8423 while(i < numcolors && time(NULL) < breakout_time)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8424 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8425 GdkColor color = { 0, rand() % 65536, rand() % 65536, rand() % 65536 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8426
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8427 if (color_is_visible(color, background, MIN_COLOR_CONTRAST, MIN_BRIGHTNESS_CONTRAST) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8428 color_is_visible(color, nick_highlight, MIN_COLOR_CONTRAST / 2, 0) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8429 color_is_visible(color, send_color, MIN_COLOR_CONTRAST / 4, 0))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8430 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8431 colors[i] = color;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8432 i++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8433 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8434 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8436 if (i < numcolors) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8437 GdkColor *c = colors;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8438 gaim_debug_warning("gtkconv", "Unable to generate enough random colors before timeout. %u colors found.\n", i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8439 colors = g_memdup(c, i * sizeof(GdkColor));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8440 g_free(c);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8441 *color_count = i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8442 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8443
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8444 return colors;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8445 }