pidgin/gtkwebviewtoolbar.c

Thu, 13 Feb 2014 03:10:45 +0100

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Thu, 13 Feb 2014 03:10:45 +0100
changeset 35552
0497dd67473c
parent 35547
561418a41b08
child 35698
302a7cb4c1ab
child 37111
efe4b7c5218a
permissions
-rw-r--r--

Fix most (all?) of webviewtoolbar issues

32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /* pidgin
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
5 * source distribution.
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * under the terms of the GNU General Public License as published by
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
16 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
20 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22 #include "internal.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
23 #include "pidgin.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
24
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
25 #include "imgstore.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26 #include "notify.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27 #include "prefs.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
28 #include "request.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
29 #include "pidginstock.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
30 #include "util.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
31 #include "debug.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
32
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
33 #include "gtkdialogs.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
34 #include "gtkwebviewtoolbar.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
35 #include "gtksmiley.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
36 #include "gtkthemes.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
37 #include "gtkutils.h"
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
38
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
39 #include <gdk/gdkkeysyms.h>
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
40
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
41 #include "gtk3compat.h"
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
42
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
43 #define PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \
35506
4252b2882889 Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents: 35500
diff changeset
44 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_WEBVIEWTOOLBAR, PidginWebViewToolbarPriv))
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
45
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
46 #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT "sans-serif"
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
47 #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_BGCOLOR "inherit"
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
48 #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FGCOLOR "#000000"
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
49
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
50 /******************************************************************************
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
51 * Structs
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
52 *****************************************************************************/
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
53
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
54 typedef struct _PidginWebViewToolbarPriv {
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
55 PurpleConversation *active_conv;
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
56
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
57 GtkWidget *wide_view;
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
58 GtkWidget *lean_view;
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
59
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
60 GtkWidget *font_label;
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
61 GtkWidget *font_menu;
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
62
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
63 GtkAction *bold;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
64 GtkAction *italic;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
65 GtkAction *underline;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
66 GtkAction *strike;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
67
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
68 GtkAction *larger_size;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
69 #if 0
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
70 GtkAction *normal_size;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
71 #endif
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
72 GtkAction *smaller_size;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
73
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
74 GtkAction *font;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
75 GtkAction *fgcolor;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
76 GtkAction *bgcolor;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
77
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
78 GtkAction *clear;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
79
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
80 GtkWidget *insert_menu;
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
81 GtkAction *image;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
82 GtkAction *link;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
83 GtkAction *hr;
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
84
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
85 GtkAction *smiley;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
86 GtkAction *attention;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
87
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
88 GtkWidget *font_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
89 GtkWidget *fgcolor_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
90 GtkWidget *bgcolor_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
91 GtkWidget *link_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
92 GtkWidget *smiley_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
93 GtkWidget *image_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
94
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
95 char *sml;
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
96 } PidginWebViewToolbarPriv;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
97
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
98 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
99 * Globals
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
100 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
101
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
102 static GtkHBoxClass *parent_class = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
103
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
104 /* XXX: I would bet, there is a better way to do this */
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
105 static guint resources_ref_cnt = 0;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
106 static GRegex *color_parse_rgb = NULL;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
107
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
108 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
109 * Prototypes
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
110 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
111
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
112 static void
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
113 toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
114 PidginWebViewToolbar *toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
115
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
116 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
117 * Helpers
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
118 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
119
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
120 static gboolean
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
121 pidgin_color_parse(const gchar *str, GdkColor *color)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
122 {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
123 GdkColor dummy_color;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
124 gboolean succ;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
125
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
126 if (str == NULL)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
127 return FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
128
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
129 while (isspace(str[0]))
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
130 str++;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
131
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
132 if (str[0] == '\0')
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
133 return FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
134
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
135 if (color == NULL)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
136 color = &dummy_color;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
137
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
138 if (strcmp(str, "inherit") == 0) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
139 return FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
140 } else if (strncmp(str, "rgb", 3) == 0) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
141 GMatchInfo *match;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
142
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
143 g_regex_match(color_parse_rgb, str, 0, &match);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
144 succ = g_match_info_matches(match);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
145 if (succ) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
146 int m_start, val;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
147
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
148 g_match_info_fetch_pos(match, 1, &m_start, NULL);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
149 val = strtoul(str + m_start, NULL, 10);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
150 if (val >= 0 && val <= 255)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
151 color->red = val * 256;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
152 else
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
153 succ = FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
154
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
155 g_match_info_fetch_pos(match, 2, &m_start, NULL);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
156 val = strtoul(str + m_start, NULL, 10);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
157 if (val >= 0 && val <= 255)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
158 color->green = val * 256;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
159 else
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
160 succ = FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
161
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
162 g_match_info_fetch_pos(match, 3, &m_start, NULL);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
163 val = strtoul(str + m_start, NULL, 10);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
164 if (val >= 0 && val <= 255)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
165 color->blue = val * 256;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
166 else
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
167 succ = FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
168 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
169
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
170 g_match_info_free(match);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
171 return succ;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
172 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
173
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
174 purple_debug_warning("gtkwebviewtoolbar",
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
175 "Invalid color format: \"%s\"", str);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
176 return FALSE;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
177 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
178
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
179 static gchar*
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
180 pidgin_color_to_str(GdkColor *color)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
181 {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
182 return g_strdup_printf("#%02X%02X%02X", color->red / 256,
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
183 color->green / 256, color->blue / 256);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
184 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
185
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
187 do_bold(GtkAction *bold, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
188 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
189 g_return_if_fail(toolbar != NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
190 pidgin_webview_toggle_bold(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
191 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
192 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
193
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
194 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
195 do_italic(GtkAction *italic, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
196 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
197 g_return_if_fail(toolbar != NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
198 pidgin_webview_toggle_italic(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
199 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
200 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
201
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
202 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
203 do_underline(GtkAction *underline, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
204 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
205 g_return_if_fail(toolbar != NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
206 pidgin_webview_toggle_underline(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
207 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
208 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
209
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
210 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
211 do_strikethrough(GtkAction *strikethrough, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
212 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
213 g_return_if_fail(toolbar != NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
214 pidgin_webview_toggle_strike(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
215 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
216 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
217
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
218 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
219 do_small(GtkAction *small, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
220 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
221 g_return_if_fail(toolbar != NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
222 pidgin_webview_font_shrink(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
223 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
224 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
225
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
226 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
227 do_big(GtkAction *large, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
228 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
229 g_return_if_fail(toolbar);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
230 pidgin_webview_font_grow(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
231 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
232 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
233
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
234 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
235 destroy_toolbar_font(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
236 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
237 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
238
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
239 if (priv->font_dialog != NULL)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
240 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
241 gtk_widget_destroy(priv->font_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
242 priv->font_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
243 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
244 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
245
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
246 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
247 realize_toolbar_font(GtkWidget *widget, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
248 {
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
249 #if !GTK_CHECK_VERSION(3,2,0)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
250 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
251 GtkFontSelection *sel;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
252
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
253 sel = GTK_FONT_SELECTION(
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
254 gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)));
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
255 gtk_widget_hide(gtk_widget_get_parent(
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
256 gtk_font_selection_get_size_entry(sel)));
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
257 gtk_widget_show_all(gtk_font_selection_get_family_list(sel));
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
258 gtk_widget_show(gtk_widget_get_parent(
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
259 gtk_font_selection_get_family_list(sel)));
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
260 gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
261 gtk_font_selection_get_family_list(sel))));
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
262 #endif
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
263 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
264
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
265 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
266 apply_font(GtkDialog *dialog, gint response, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
267 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
268 /* this could be expanded to include font size, weight, etc.
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
269 but for now only works with font face */
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
270 gchar *fontname = NULL;
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
271
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
272 if (response == GTK_RESPONSE_OK)
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
273 fontname = gtk_font_chooser_get_font(GTK_FONT_CHOOSER(dialog));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
274
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
275 if (fontname) {
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
276 PangoFontDescription *desc;
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
277 const gchar *family_name;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
278
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
279 desc = pango_font_description_from_string(fontname);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
280 family_name = pango_font_description_get_family(desc);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
281
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
282 if (family_name) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
283 pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview),
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
284 family_name);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
285 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
286
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
287 pango_font_description_free(desc);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
288 g_free(fontname);
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
289 } else {
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
290 pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview),
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
291 PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
292 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
293
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
294 destroy_toolbar_font(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
295 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
296
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
297 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
298 toggle_font(GtkAction *font, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
299 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
300 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
301
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
302 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(font))) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
303 char *fontname = pidgin_webview_get_current_fontface(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
304
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
305 if (!priv->font_dialog) {
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
306 GtkWindow *window;
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
307 window = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar)));
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
308 priv->font_dialog = gtk_font_chooser_dialog_new(_("Select Font"), window);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
309
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
310 if (fontname) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
311 char *fonttif = g_strdup_printf("%s 12", fontname);
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
312 gtk_font_chooser_set_font(GTK_FONT_CHOOSER(priv->font_dialog),
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
313 fonttif);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
314 g_free(fonttif);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
315 } else {
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
316 gtk_font_chooser_set_font(GTK_FONT_CHOOSER(priv->font_dialog),
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
317 PIDGIN_DEFAULT_FONT_FACE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
318 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
319
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
320 g_signal_connect(G_OBJECT(priv->font_dialog), "response",
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
321 G_CALLBACK(apply_font), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
322 g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize",
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
323 G_CALLBACK(realize_toolbar_font), toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
324 }
32818
d5a17a5c1f29 Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32817
diff changeset
325
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
326 gtk_window_present(GTK_WINDOW(priv->font_dialog));
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
327
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
328 g_free(fontname);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
329 } else {
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
330 pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview),
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
331 PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT);
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
332 destroy_toolbar_font(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
333 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
334
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
335 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
336 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
337
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
338 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
339 destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event,
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
340 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
341 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
342 PidginWebViewToolbarPriv *priv =
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
343 PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
344
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
345 if (widget != NULL) {
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
346 pidgin_webview_toggle_forecolor(
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
347 PIDGIN_WEBVIEW(toolbar->webview),
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
348 PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FGCOLOR);
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
349 }
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
350
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
351 if (priv->fgcolor_dialog != NULL) {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
352 gtk_widget_destroy(priv->fgcolor_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
353 priv->fgcolor_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
354 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
355
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
356 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
357 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
358
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
359 static void
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
360 do_fgcolor(GtkDialog *dialog, gint response, gpointer _toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
361 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
362 PidginWebViewToolbar *toolbar = _toolbar;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
363 GdkColor text_color;
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
364 gchar *open_tag;
32818
d5a17a5c1f29 Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32817
diff changeset
365
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
366 if (response != GTK_RESPONSE_OK) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
367 destroy_toolbar_fgcolor(GTK_WIDGET(toolbar), NULL, toolbar);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
368 return;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
369 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
370
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
371 pidgin_color_chooser_get_rgb(GTK_COLOR_CHOOSER(dialog), &text_color);
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
372 open_tag = pidgin_color_to_str(&text_color);
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
373 pidgin_webview_toggle_forecolor(PIDGIN_WEBVIEW(toolbar->webview),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
374 open_tag);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
375 g_free(open_tag);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
376
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
377 destroy_toolbar_fgcolor(NULL, NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
378 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
379
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
380 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
381 toggle_fg_color(GtkAction *color, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
382 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
383 PidginWebViewToolbarPriv *priv =
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
384 PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
385
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
386 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
387 GdkColor fgcolor;
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
388 gchar *color = pidgin_webview_get_current_forecolor(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
389 PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
390
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
391 if (!priv->fgcolor_dialog) {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
392 priv->fgcolor_dialog = gtk_color_chooser_dialog_new(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
393 _("Select Text Color"), GTK_WINDOW(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
394 gtk_widget_get_ancestor(toolbar->webview,
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
395 GTK_TYPE_WINDOW)));
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
396 gtk_color_chooser_set_use_alpha(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
397 GTK_COLOR_CHOOSER(priv->fgcolor_dialog), FALSE);
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
398
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
399 if (pidgin_color_parse(color, &fgcolor)) {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
400 pidgin_color_chooser_set_rgb(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
401 GTK_COLOR_CHOOSER(priv->fgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
402 &fgcolor);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
403 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
404
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
405 g_signal_connect(G_OBJECT(priv->fgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
406 "delete_event",
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
407 G_CALLBACK(destroy_toolbar_fgcolor), toolbar);
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
408
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
409 g_signal_connect(G_OBJECT(priv->fgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
410 "response", G_CALLBACK(do_fgcolor), toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
411 }
32818
d5a17a5c1f29 Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32817
diff changeset
412
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
413 g_free(color);
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
414
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
415 gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
416 } else {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
417 destroy_toolbar_fgcolor(GTK_WIDGET(toolbar), NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
418 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
419
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
420 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
421 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
422
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
423 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
424 destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event,
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
425 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
426 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
427 PidginWebViewToolbarPriv *priv =
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
428 PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
429 if (widget != NULL) {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
430 pidgin_webview_toggle_backcolor(
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
431 PIDGIN_WEBVIEW(toolbar->webview),
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
432 PIDGIN_WEBVIEWTOOLBAR_DEFAULT_BGCOLOR);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
433 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
434
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
435 if (priv->bgcolor_dialog != NULL) {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
436 gtk_widget_destroy(priv->bgcolor_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
437 priv->bgcolor_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
438 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
439
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
440 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
441 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
442
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
443 static void
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
444 do_bgcolor(GtkDialog *dialog, gint response, gpointer _toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
445 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
446 PidginWebViewToolbar *toolbar = _toolbar;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
447 GdkColor text_color;
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
448 gchar *open_tag;
32818
d5a17a5c1f29 Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32817
diff changeset
449
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
450 if (response != GTK_RESPONSE_OK) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
451 destroy_toolbar_bgcolor(GTK_WIDGET(toolbar), NULL, toolbar);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
452 return;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
453 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
454
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
455 pidgin_color_chooser_get_rgb(GTK_COLOR_CHOOSER(dialog), &text_color);
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
456 open_tag = pidgin_color_to_str(&text_color);
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
457 pidgin_webview_toggle_backcolor(PIDGIN_WEBVIEW(toolbar->webview),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
458 open_tag);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
459 g_free(open_tag);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
460
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
461 destroy_toolbar_bgcolor(NULL, NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
462 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
463
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
464 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
465 toggle_bg_color(GtkAction *color, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
466 {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
467 PidginWebViewToolbarPriv *priv =
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
468 PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
469
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
470 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
471 GdkColor bgcolor;
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
472 gchar *color = pidgin_webview_get_current_backcolor(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
473 PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
474
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
475 if (!priv->bgcolor_dialog) {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
476 priv->bgcolor_dialog = gtk_color_chooser_dialog_new(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
477 _("Select Background Color"), GTK_WINDOW(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
478 gtk_widget_get_ancestor(toolbar->webview,
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
479 GTK_TYPE_WINDOW)));
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
480 gtk_color_chooser_set_use_alpha(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
481 GTK_COLOR_CHOOSER(priv->bgcolor_dialog), FALSE);
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
482
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
483 if (pidgin_color_parse(color, &bgcolor)) {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
484 pidgin_color_chooser_set_rgb(
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
485 GTK_COLOR_CHOOSER(priv->bgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
486 &bgcolor);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
487 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
488
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
489 g_signal_connect(G_OBJECT(priv->bgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
490 "delete_event",
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
491 G_CALLBACK(destroy_toolbar_bgcolor), toolbar);
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
492 g_signal_connect(G_OBJECT(priv->bgcolor_dialog),
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
493 "response", G_CALLBACK(do_bgcolor), toolbar);
32818
d5a17a5c1f29 Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32817
diff changeset
494 }
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
495 g_free(color);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
496
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
497 gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
498 } else {
35547
561418a41b08 Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
499 destroy_toolbar_bgcolor(GTK_WIDGET(toolbar), NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
500 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
501
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
502 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
503 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
504
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
505 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
506 clear_formatting_cb(GtkAction *clear, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
507 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
508 pidgin_webview_clear_formatting(PIDGIN_WEBVIEW(toolbar->webview));
33023
35de4c169b1a This focus grab seems to be in the wrong place.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33019
diff changeset
509 gtk_widget_grab_focus(toolbar->webview);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
510 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
511
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
512 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
513 cancel_link_cb(PidginWebViewToolbar *toolbar, PurpleRequestFields *fields)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
514 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
515 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
516 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
517
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
518 priv->link_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
519 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
520
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
521 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
522 close_link_dialog(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
523 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
524 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
525 if (priv->link_dialog != NULL)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
526 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
527 purple_request_close(PURPLE_REQUEST_FIELDS, priv->link_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
528 priv->link_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
529 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
530 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
531
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
532 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
533 do_insert_link_cb(PidginWebViewToolbar *toolbar, PurpleRequestFields *fields)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
534 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
535 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
536 const char *url, *description;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
537
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
538 url = purple_request_fields_get_string(fields, "url");
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
539 if (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_LINKDESC)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
540 description = purple_request_fields_get_string(fields, "description");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
541 else
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
542 description = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
543
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
544 pidgin_webview_insert_link(PIDGIN_WEBVIEW(toolbar->webview), url, description);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
545
33019
83a3a76bf86d Fix a widget type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33017
diff changeset
546 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
547
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
548 priv->link_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
549 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
550
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
551 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
552 insert_link_cb(GtkAction *action, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
553 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
554 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
555
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
556 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->link))) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
557 PurpleRequestFields *fields;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
558 PurpleRequestFieldGroup *group;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
559 PurpleRequestField *field;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
560 char *msg;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
561 char *desc = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
562
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
563 fields = purple_request_fields_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
564
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
565 group = purple_request_field_group_new(NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
566 purple_request_fields_add_group(fields, group);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
567
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
568 field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
569 purple_request_field_set_required(field, TRUE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
570 purple_request_field_group_add_field(group, field);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
571
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
572 if (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_LINKDESC) {
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
573 desc = pidgin_webview_get_selected_text(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
574 field = purple_request_field_string_new("description", _("_Description"),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
575 desc, FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
576 purple_request_field_group_add_field(group, field);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
577 msg = g_strdup(_("Please enter the URL and description of the "
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
578 "link that you want to insert. The description "
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
579 "is optional."));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
580 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
581 msg = g_strdup(_("Please enter the URL of the "
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
582 "link that you want to insert."));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
583 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
584
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
585 priv->link_dialog =
34332
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
586 purple_request_fields(toolbar, _("Insert Link"), NULL,
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
587 msg, fields, _("_Insert"),
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
588 G_CALLBACK(do_insert_link_cb), _("Cancel"),
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
589 G_CALLBACK(cancel_link_cb), NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
590 g_free(msg);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
591 g_free(desc);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
592 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
593 close_link_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
594 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
595
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
596 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
597 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
598
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
599 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
600 insert_hr_cb(GtkAction *action, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
601 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
602 pidgin_webview_insert_hr(PIDGIN_WEBVIEW(toolbar->webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
603 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
604
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
605 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
606 do_insert_image_cb(GtkWidget *widget, int response, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
607 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
608 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33017
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
609 gchar *filename = NULL, *name, *buf;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
610 char *filedata;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
611 size_t size;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
612 GError *error = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
613 int id;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
614
33017
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
615 if (response == GTK_RESPONSE_ACCEPT)
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
616 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
617
33017
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
618 /* The following triggers a callback that closes the widget */
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
619 gtk_action_activate(priv->image);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
620
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
621 if (filename == NULL)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
622 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
623
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
624 if (!g_file_get_contents(filename, &filedata, &size, &error)) {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
625 purple_notify_error(NULL, NULL, error->message, NULL, NULL);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
626
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
627 g_error_free(error);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
628 g_free(filename);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
629
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
630 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
631 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
632
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
633 name = strrchr(filename, G_DIR_SEPARATOR) + 1;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
634
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33398
diff changeset
635 id = purple_imgstore_new_with_id(filedata, size, name);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
636
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
637 if (id == 0) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
638 buf = g_strdup_printf(_("Failed to store image: %s\n"), filename);
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
639 purple_notify_error(NULL, NULL, buf, NULL, NULL);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
640
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
641 g_free(buf);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
642 g_free(filename);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
643
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
644 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
645 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
646
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
647 g_free(filename);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
648
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
649 pidgin_webview_insert_image(PIDGIN_WEBVIEW(toolbar->webview), id);
33398
bb0e3f84034c Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33277
diff changeset
650 /* TODO: do it after passing an image to prpl, not before
bb0e3f84034c Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33277
diff changeset
651 * purple_imgstore_unref_by_id(id);
bb0e3f84034c Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33277
diff changeset
652 */
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
653 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
654
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
655 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
656 insert_image_cb(GtkAction *action, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
657 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
658 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
659 GtkWidget *window;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
660
33017
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
661 if (!priv->image_dialog) {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
662 window = gtk_file_chooser_dialog_new(_("Insert Image"), NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
663 GTK_FILE_CHOOSER_ACTION_OPEN,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
664 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
665 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
666 NULL);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
667 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT);
33017
d21ab88ad911 Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33015
diff changeset
668 g_signal_connect(G_OBJECT(window), "response",
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
669 G_CALLBACK(do_insert_image_cb), toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
670
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
671 gtk_widget_show(window);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
672 priv->image_dialog = window;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
673 } else {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
674 gtk_widget_destroy(priv->image_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
675 priv->image_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
676 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
677
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
678 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
679 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
680
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
681 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
682 destroy_smiley_dialog(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
683 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
684 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
685 if (priv->smiley_dialog != NULL)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
686 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
687 gtk_widget_destroy(priv->smiley_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
688 priv->smiley_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
689 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
690 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
691
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
692 static gboolean
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
693 close_smiley_dialog(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
694 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
695 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
696 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->smiley), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
697 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
698 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
699
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
700 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
701 insert_smiley_text(GtkWidget *widget, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
702 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
703 char *smiley_text, *escaped_smiley;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
704
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
705 smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
706 escaped_smiley = g_markup_escape_text(smiley_text, -1);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
707
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
708 pidgin_webview_insert_smiley(PIDGIN_WEBVIEW(toolbar->webview),
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
709 pidgin_webview_get_protocol_name(PIDGIN_WEBVIEW(toolbar->webview)),
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
710 escaped_smiley);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
711
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
712 g_free(escaped_smiley);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
713
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
714 close_smiley_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
715 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
716
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
717 /* smiley buttons list */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
718 struct smiley_button_list {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
719 int width, height;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
720 GtkWidget *button;
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
721 const PidginWebViewSmiley *smiley;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
722 struct smiley_button_list *next;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
723 };
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
724
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
725 static struct smiley_button_list *
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
726 sort_smileys(struct smiley_button_list *ls, PidginWebViewToolbar *toolbar,
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
727 int *width, const PidginWebViewSmiley *smiley)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
728 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
729 GtkWidget *image;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
730 GtkWidget *button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
731 GtkRequisition size;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
732 struct smiley_button_list *cur;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
733 struct smiley_button_list *it, *it_last;
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
734 const gchar *filename = pidgin_webview_smiley_get_file(smiley);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
735 const gchar *face = pidgin_webview_smiley_get_smile(smiley);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
736 PurpleSmiley *psmiley = NULL;
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
737 gboolean supports_custom = (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_CUSTOM_SMILEY);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
738
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
739 cur = g_new0(struct smiley_button_list, 1);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
740 it = ls;
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
741 it_last = ls; /* list iterators */
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
742 image = gtk_image_new_from_file(filename);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
743
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33276
diff changeset
744 gtk_widget_get_preferred_size(image, NULL, &size);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
745
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
746 if ((size.width > 24)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
747 && (pidgin_webview_smiley_get_flags(smiley) & PIDGIN_WEBVIEW_SMILEY_CUSTOM)) {
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
748 /* This is a custom smiley, let's scale it */
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
749 GdkPixbuf *pixbuf = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
750 GtkImageType type;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
751
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
752 type = gtk_image_get_storage_type(GTK_IMAGE(image));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
753
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
754 if (type == GTK_IMAGE_PIXBUF) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
755 pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
756 } else if (type == GTK_IMAGE_ANIMATION) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
757 GdkPixbufAnimation *animation;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
758
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
759 animation = gtk_image_get_animation(GTK_IMAGE(image));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
760
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
761 pixbuf = gdk_pixbuf_animation_get_static_image(animation);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
762 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
763
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
764 if (pixbuf != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
765 GdkPixbuf *resized;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
766 resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
767 GDK_INTERP_HYPER);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
768
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
769 gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33276
diff changeset
770 gtk_widget_get_preferred_size(image, NULL, &size);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
771 g_object_unref(G_OBJECT(resized));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
772 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
773 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
774
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
775 (*width) += size.width;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
776
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
777 button = gtk_button_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
778 gtk_container_add(GTK_CONTAINER(button), image);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
779
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
780 g_object_set_data_full(G_OBJECT(button), "smiley_text", g_strdup(face), g_free);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
781 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
782
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
783 gtk_widget_set_tooltip_text(button, face);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
784
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
785 /* these look really weird with borders */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
786 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
787
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
788 psmiley = purple_smileys_find_by_shortcut(face);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
789 /* If this is a "non-custom" smiley, check to see if its shortcut is
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
790 "shadowed" by any custom smiley. This can only happen if the connection
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
791 is custom smiley-enabled */
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
792 if (supports_custom && psmiley
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
793 && !(pidgin_webview_smiley_get_flags(smiley) & PIDGIN_WEBVIEW_SMILEY_CUSTOM)) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
794 gchar tip[128];
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
795 g_snprintf(tip, sizeof(tip),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
796 _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
797 face);
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
798 gtk_widget_set_tooltip_text(button, tip);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
799 gtk_widget_set_sensitive(button, FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
800 } else if (psmiley) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
801 /* Remove the button if the smiley is destroyed */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
802 g_signal_connect_object(G_OBJECT(psmiley), "destroy", G_CALLBACK(gtk_widget_destroy),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
803 button, G_CONNECT_SWAPPED);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
804 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
805
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
806 /* set current element to add */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
807 cur->height = size.height;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
808 cur->width = size.width;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
809 cur->button = button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
810 cur->smiley = smiley;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
811 cur->next = ls;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
812
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
813 /* check where to insert by height */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
814 if (ls == NULL)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
815 return cur;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
816 while (it != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
817 it_last = it;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
818 it = it->next;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
819 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
820 cur->next = it;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
821 it_last->next = cur;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
822 return ls;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
823 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
824
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
825 static gboolean
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
826 smiley_is_unique(GSList *list, PidginWebViewSmiley *smiley)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
827 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
828 const char *file = pidgin_webview_smiley_get_file(smiley);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
829 while (list) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
830 PidginWebViewSmiley *cur = (PidginWebViewSmiley *)list->data;
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
831 if (!strcmp(pidgin_webview_smiley_get_file(cur), file))
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
832 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
833 list = list->next;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
834 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
835 return TRUE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
836 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
837
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
838 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
839 smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
840 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
841 {
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
842 if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) ||
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
843 (event->type == GDK_BUTTON_PRESS && event->button.button == 1))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
844 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
845 close_smiley_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
846 return TRUE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
847 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
848
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
849 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
850 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
851
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
852 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
853 add_smiley_list(GtkWidget *container, struct smiley_button_list *list,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
854 int max_width, gboolean custom)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
855 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
856 GtkWidget *line;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
857 int line_width = 0;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
858
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
859 if (!list)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
860 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
861
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35506
diff changeset
862 line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
863 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
864 for (; list; list = list->next) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
865 if (custom != !!(pidgin_webview_smiley_get_flags(list->smiley) & PIDGIN_WEBVIEW_SMILEY_CUSTOM))
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
866 continue;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
867 gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
868 gtk_widget_show(list->button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
869 line_width += list->width;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
870 if (line_width >= max_width) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
871 if (list->next) {
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35506
diff changeset
872 line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
873 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
874 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
875 line_width = 0;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
876 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
877 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
878 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
879
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
880 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
881 insert_smiley_cb(GtkAction *smiley, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
882 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
883 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
884 GtkWidget *dialog, *vbox;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
885 GtkWidget *smiley_table = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
886 GSList *smileys, *unique_smileys = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
887 const GSList *custom_smileys = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
888 gboolean supports_custom = FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
889 GtkRequisition req;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
890 GtkWidget *scrolled, *viewport;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
891
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
892 if (!gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(smiley))) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
893 destroy_smiley_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
894 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
895 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
896 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
897
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
898 if (priv->sml)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
899 smileys = pidgin_themes_get_proto_smileys(priv->sml);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
900 else
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
901 smileys = pidgin_themes_get_proto_smileys(NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
902
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
903 /* Note: prepend smileys to list to avoid O(n^2) overhead when there is a
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
904 large number of smileys... need to reverse the list after for the dialog
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
905 to work... */
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
906 while (smileys) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
907 PidginWebViewSmiley *smiley = (PidginWebViewSmiley *)smileys->data;
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
908 if (!pidgin_webview_smiley_get_hidden(smiley)) {
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
909 if (smiley_is_unique(unique_smileys, smiley)) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
910 unique_smileys = g_slist_prepend(unique_smileys, smiley);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
911 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
912 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
913 smileys = smileys->next;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
914 }
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
915 supports_custom = (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_CUSTOM_SMILEY);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
916 if (toolbar->webview && supports_custom) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
917 const GSList *iterator = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
918 custom_smileys = pidgin_smileys_get_all();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
919
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
920 for (iterator = custom_smileys ; iterator ;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
921 iterator = g_slist_next(iterator)) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
922 PidginWebViewSmiley *smiley = (PidginWebViewSmiley *)iterator->data;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
923 unique_smileys = g_slist_prepend(unique_smileys, smiley);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
924 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
925 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
926
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
927 /* we need to reverse the list to get the smileys in the correct order */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
928 unique_smileys = g_slist_reverse(unique_smileys);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
929
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
930 dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
931 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
932 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
933
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
934 if (unique_smileys != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
935 struct smiley_button_list *ls;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
936 int max_line_width, num_lines, button_width = 0;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
937
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
938 /* We use hboxes packed in a vbox */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
939 ls = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
940 max_line_width = 0;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
941 num_lines = floor(sqrt(g_slist_length(unique_smileys)));
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35506
diff changeset
942 smiley_table = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
943
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
944 if (supports_custom) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
945 GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
946 GtkRequisition req;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
947 g_signal_connect(G_OBJECT(manage), "clicked",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
948 G_CALLBACK(pidgin_smiley_manager_show), NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
949 g_signal_connect_swapped(G_OBJECT(manage), "clicked",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
950 G_CALLBACK(gtk_widget_destroy), dialog);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
951 gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33276
diff changeset
952 gtk_widget_get_preferred_size(manage, NULL, &req);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
953 button_width = req.width;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
954 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
955
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
956 /* create list of smileys sorted by height */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
957 while (unique_smileys) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
958 PidginWebViewSmiley *smiley = (PidginWebViewSmiley *)unique_smileys->data;
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
959 if (!pidgin_webview_smiley_get_hidden(smiley)) {
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
960 ls = sort_smileys(ls, toolbar, &max_line_width, smiley);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
961 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
962 unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
963 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
964 /* The window will be at least as wide as the 'Manage ..' button */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
965 max_line_width = MAX(button_width, max_line_width / num_lines);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
966
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
967 /* pack buttons of the list */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
968 add_smiley_list(smiley_table, ls, max_line_width, FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
969 if (supports_custom) {
35528
e04ba70092e9 Fix the rest of [hv] gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
970 gtk_box_pack_start(GTK_BOX(smiley_table), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), TRUE, FALSE, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
971 add_smiley_list(smiley_table, ls, max_line_width, TRUE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
972 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
973 while (ls) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
974 struct smiley_button_list *tmp = ls->next;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
975 g_free(ls);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
976 ls = tmp;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
977 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
978
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
979 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
980 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
981 else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
982 smiley_table = gtk_label_new(_("This theme has no available smileys."));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
983 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
984 g_signal_connect(G_OBJECT(dialog), "button-press-event", (GCallback)smiley_dialog_input_cb, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
985 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
986
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
987 scrolled = pidgin_make_scrollable(smiley_table, GTK_POLICY_NEVER, GTK_POLICY_NEVER, GTK_SHADOW_NONE, -1, -1);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
988 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
989 gtk_widget_show(smiley_table);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
990
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
991 viewport = gtk_widget_get_parent(smiley_table);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
992 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
993
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
994 /* connect signals */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
995 g_signal_connect_swapped(G_OBJECT(dialog), "destroy", G_CALLBACK(close_smiley_dialog), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
996 g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(smiley_dialog_input_cb), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
997
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
998 gtk_window_set_transient_for(GTK_WINDOW(dialog),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
999 GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar))));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1000
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1001 /* show everything */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1002 gtk_widget_show_all(dialog);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1003
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33276
diff changeset
1004 gtk_widget_get_preferred_size(viewport, NULL, &req);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1005 gtk_widget_set_size_request(scrolled, MIN(300, req.width), MIN(290, req.height));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1006
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1007 /* The window has to be made resizable, and the scrollbars in the scrolled window
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1008 * enabled only after setting the desired size of the window. If we do either of
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1009 * these tasks before now, GTK+ miscalculates the required size, and erronously
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1010 * makes one or both scrollbars visible (sometimes).
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1011 * I too think this hack is gross. But I couldn't find a better way -- sadrul */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1012 gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1013 g_object_set(G_OBJECT(scrolled),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1014 "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1015 "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1016 NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1017
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1018 #ifdef _WIN32
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1019 winpidgin_ensure_onscreen(dialog);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1020 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1021
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1022 priv->smiley_dialog = dialog;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1023
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1024 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1025 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1026
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1027 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1028 send_attention_cb(GtkAction *attention, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1029 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1030 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1031 PurpleConversation *conv = priv->active_conv;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1032 const gchar *who = purple_conversation_get_name(conv);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1033 PurpleConnection *gc = purple_conversation_get_connection(conv);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1034
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1035 purple_prpl_send_attention(gc, who, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1036 gtk_widget_grab_focus(toolbar->webview);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1037 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1038
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1039 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1040 update_buttons_cb(PidginWebView *webview, PidginWebViewButtons buttons,
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1041 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1042 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1043 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1044
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1045 gtk_action_set_sensitive(priv->bold, buttons & PIDGIN_WEBVIEW_BOLD);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1046 gtk_action_set_sensitive(priv->italic, buttons & PIDGIN_WEBVIEW_ITALIC);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1047 gtk_action_set_sensitive(priv->underline, buttons & PIDGIN_WEBVIEW_UNDERLINE);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1048 gtk_action_set_sensitive(priv->strike, buttons & PIDGIN_WEBVIEW_STRIKE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1049
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1050 gtk_action_set_sensitive(priv->larger_size, buttons & PIDGIN_WEBVIEW_GROW);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1051 gtk_action_set_sensitive(priv->smaller_size, buttons & PIDGIN_WEBVIEW_SHRINK);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1052
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1053 gtk_action_set_sensitive(priv->font, buttons & PIDGIN_WEBVIEW_FACE);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1054 gtk_action_set_sensitive(priv->fgcolor, buttons & PIDGIN_WEBVIEW_FORECOLOR);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1055 gtk_action_set_sensitive(priv->bgcolor, buttons & PIDGIN_WEBVIEW_BACKCOLOR);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1056
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1057 gtk_action_set_sensitive(priv->clear,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1058 (buttons & PIDGIN_WEBVIEW_BOLD ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1059 buttons & PIDGIN_WEBVIEW_ITALIC ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1060 buttons & PIDGIN_WEBVIEW_UNDERLINE ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1061 buttons & PIDGIN_WEBVIEW_STRIKE ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1062 buttons & PIDGIN_WEBVIEW_GROW ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1063 buttons & PIDGIN_WEBVIEW_SHRINK ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1064 buttons & PIDGIN_WEBVIEW_FACE ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1065 buttons & PIDGIN_WEBVIEW_FORECOLOR ||
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1066 buttons & PIDGIN_WEBVIEW_BACKCOLOR));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1067
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1068 gtk_action_set_sensitive(priv->image, buttons & PIDGIN_WEBVIEW_IMAGE);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1069 gtk_action_set_sensitive(priv->link, buttons & PIDGIN_WEBVIEW_LINK);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1070 gtk_action_set_sensitive(priv->smiley, (buttons & PIDGIN_WEBVIEW_SMILEY) &&
34283
800cf8ff15f8 Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34282
diff changeset
1071 pidgin_themes_get_proto_smileys(priv->sml));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1072 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1073
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1074 /* we call this when we want to _set_active the toggle button, it'll
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1075 * block the callback that's connected to the button so we don't have to
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1076 * do the double toggling hack
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1077 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1078 static void
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1079 toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1080 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1081 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1082 GObject *object;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1083 g_return_if_fail(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1084
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1085 object = g_object_ref(action);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1086 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA,
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1087 0, 0, NULL, NULL, toolbar);
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1088
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1089 gtk_toggle_action_set_active(action, is_active);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1090 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA,
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1091 0, 0, NULL, NULL, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1092 g_object_unref(object);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1093 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1094
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1095 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1096 update_buttons(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1097 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1098 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1099 gboolean bold, italic, underline, strike;
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1100 char *tmp, *color_str;
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1101 char *label;
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1102 GdkColor color;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1103
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1104 label = g_strdup(_("_Font"));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1105
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1106 pidgin_webview_get_current_format(PIDGIN_WEBVIEW(toolbar->webview),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1107 &bold, &italic, &underline, &strike);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1108
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1109 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->bold)) != bold)
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1110 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bold), bold,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1111 toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1112 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->italic)) != italic)
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1113 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->italic), italic,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1114 toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1115 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->underline)) != underline)
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1116 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->underline),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1117 underline, toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1118 if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->strike)) != strike)
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1119 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->strike), strike,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1120 toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1121
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1122 if (bold) {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1123 gchar *markup = g_strdup_printf("<b>%s</b>", label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1124 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1125 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1126 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1127 if (italic) {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1128 gchar *markup = g_strdup_printf("<i>%s</i>", label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1129 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1130 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1131 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1132 if (underline) {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1133 gchar *markup = g_strdup_printf("<u>%s</u>", label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1134 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1135 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1136 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1137 if (strike) {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1138 gchar *markup = g_strdup_printf("<s>%s</s>", label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1139 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1140 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1141 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1142
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1143 tmp = pidgin_webview_get_current_fontface(PIDGIN_WEBVIEW(toolbar->webview));
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1144 if (tmp && tmp[0] == '\0')
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1145 tmp = NULL;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1146 if (g_strcmp0(tmp, PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT) == 0)
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1147 tmp = NULL;
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1148 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->font),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1149 (tmp && *tmp), toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1150 if (tmp && *tmp) {
35126
669cb2286130 Remove "'fontdesc' attribute not allowed in <span>" warnings
Ankit Vani <a@nevitus.org>
parents: 35094
diff changeset
1151 gchar *markup = g_strdup_printf("<span face=\"%s\">%s</span>",
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1152 tmp, label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1153 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1154 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1155 }
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1156 g_free(tmp);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1157
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1158 tmp = pidgin_webview_get_current_forecolor(
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1159 PIDGIN_WEBVIEW(toolbar->webview));
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1160 color_str = NULL;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1161 if (pidgin_color_parse(tmp, &color) &&
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1162 (color.red != 0 || color.green != 0 || color.blue != 0))
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1163 {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1164 color_str = pidgin_color_to_str(&color);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1165 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1166 g_free(tmp);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1167
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1168 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->fgcolor),
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1169 color_str != NULL, toolbar);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1170 if (color_str) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1171 gchar *markup = g_strdup_printf(
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1172 "<span foreground=\"%s\">%s</span>", color_str, label);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1173 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1174 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1175 }
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1176 g_free(color_str);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1177
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1178 tmp = pidgin_webview_get_current_backcolor(
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1179 PIDGIN_WEBVIEW(toolbar->webview));
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1180 color_str = NULL;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1181 if (pidgin_color_parse(tmp, &color))
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1182 {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1183 color_str = pidgin_color_to_str(&color);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1184 }
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1185 g_free(tmp);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1186
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1187 toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bgcolor),
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1188 color_str != NULL, toolbar);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1189 if (color_str) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1190 gchar *markup = g_strdup_printf(
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1191 "<span background=\"%s\">%s</span>", color_str, label);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1192 g_free(label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1193 label = markup;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1194 }
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1195 g_free(color_str);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1196
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1197 gtk_label_set_markup_with_mnemonic(GTK_LABEL(priv->font_label), label);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1198 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1199
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1200 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1201 toggle_button_cb(PidginWebView *webview, PidginWebViewButtons buttons,
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1202 PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1203 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1204 update_buttons(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1205 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1206
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1207 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1208 update_format_cb(PidginWebView *webview, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1209 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1210 update_buttons(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1211 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1212
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1213 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1214 mark_set_cb(PidginWebView *webview, PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1215 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1216 update_buttons(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1217 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1218
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1219 /* This comes from gtkmenutoolbutton.c from gtk+
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1220 * Copyright (C) 2003 Ricardo Fernandez Pascual
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1221 * Copyright (C) 2004 Paolo Borelli
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1222 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1223 static void
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1224 menu_position_func(GtkMenu *menu,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1225 int *x,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1226 int *y,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1227 gboolean *push_in,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1228 gpointer data)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1229 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1230 GtkWidget *widget = GTK_WIDGET(data);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1231 GtkRequisition menu_req;
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1232 GtkAllocation allocation;
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1233 gint ythickness = gtk_widget_get_style(widget)->ythickness;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1234 int savy;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1235
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1236 gtk_widget_get_allocation(widget, &allocation);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33276
diff changeset
1237 gtk_widget_get_preferred_size(GTK_WIDGET(menu), NULL, &menu_req);
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1238 gdk_window_get_origin(gtk_widget_get_window(widget), x, y);
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1239 *x += allocation.x;
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1240 *y += allocation.y + allocation.height;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1241 savy = *y;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1242
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1243 pidgin_menu_position_func_helper(menu, x, y, push_in, data);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1244
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1245 if (savy > *y + ythickness + 1)
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1246 *y -= allocation.height;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1247 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1248
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1249 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1250 pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1251 {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1252 if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(button))) {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1253 gtk_widget_show_all(GTK_WIDGET(menu));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1254 gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time());
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1255 }
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1256 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1257
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1258 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1259 pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1260 {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1261 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(button), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1262 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1263
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1264 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1265 switch_toolbar_view(GtkWidget *item, PidginWebViewToolbar *toolbar)
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1266 {
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1267 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide",
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1268 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide"));
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1269 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1270
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1271 static gboolean
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1272 pidgin_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event,
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1273 PidginWebViewToolbar *toolbar)
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1274 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1275 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1276 GtkWidget *menu;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1277 GtkWidget *item;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1278 gboolean wide;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1279
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1280 if (event->button != 3)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1281 return FALSE;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1282
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1283 wide = gtk_widget_get_visible(priv->wide_view);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1284
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1285 menu = gtk_menu_new();
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1286 item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items"));
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1287 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1288 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1289 gtk_widget_show(item);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1290
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1291 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper,
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1292 widget, event->button, event->time);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1293
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1294 return TRUE;
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1295 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1296
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1297 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1298 enable_markup(GtkWidget *widget, gpointer null)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1299 {
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1300 GtkWidget *label;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1301 label = gtk_bin_get_child(GTK_BIN(widget));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1302 if (GTK_IS_LABEL(label))
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1303 g_object_set(G_OBJECT(label), "use-markup", TRUE, NULL);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1304 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1305
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1306 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1307 webviewtoolbar_view_pref_changed(const char *name, PurplePrefType type,
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1308 gconstpointer value, gpointer toolbar)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1309 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1310 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1311 if (value) {
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1312 gtk_widget_hide(priv->lean_view);
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1313 gtk_widget_show_all(priv->wide_view);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1314 } else {
33131
c73cb391930b Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1315 gtk_widget_hide(priv->wide_view);
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1316 gtk_widget_show_all(priv->lean_view);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1317 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1318 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1319
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1320 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1321 * GObject stuff
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1322 *****************************************************************************/
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1323
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1324 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1325 pidgin_webviewtoolbar_finalize(GObject *object)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1326 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1327 PidginWebViewToolbar *toolbar = PIDGIN_WEBVIEWTOOLBAR(object);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1328 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1329
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1330 if (priv->image_dialog != NULL)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1331 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1332 gtk_widget_destroy(priv->image_dialog);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1333 priv->image_dialog = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1334 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1335
33275
8da9d2ec671d Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33266
diff changeset
1336 destroy_toolbar_font(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1337 if (priv->smiley_dialog != NULL) {
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1338 g_signal_handlers_disconnect_by_func(G_OBJECT(priv->smiley_dialog), close_smiley_dialog, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1339 destroy_smiley_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1340 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1341 destroy_toolbar_bgcolor(NULL, NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1342 destroy_toolbar_fgcolor(NULL, NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1343 close_link_dialog(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1344 if (toolbar->webview) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1345 g_signal_handlers_disconnect_matched(toolbar->webview,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1346 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1347 toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1348 #if 0
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1349 g_signal_handlers_disconnect_matched(PIDGIN_WEBVIEW(toolbar->webview)->text_buffer,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1350 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1351 toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1352 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1353 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1354
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1355 g_free(priv->sml);
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1356
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1357 if (priv->font_menu)
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1358 gtk_widget_destroy(priv->font_menu);
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1359 if (priv->insert_menu)
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1360 gtk_widget_destroy(priv->insert_menu);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1361
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1362 purple_prefs_disconnect_by_handle(object);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1363
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1364 if (--resources_ref_cnt == 0) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1365 g_regex_unref(color_parse_rgb);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1366 color_parse_rgb = NULL;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1367 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1368
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1369 G_OBJECT_CLASS(parent_class)->finalize(object);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1370 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1371
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1372 static void
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1373 pidgin_webviewtoolbar_class_init(gpointer _class, gpointer class_data)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1374 {
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1375 PidginWebViewToolbarClass *class = _class;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1376 GObjectClass *gobject_class = _class;
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1377
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1378 parent_class = g_type_class_ref(GTK_TYPE_HBOX);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1379 gobject_class->finalize = pidgin_webviewtoolbar_finalize;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1380
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1381 g_type_class_add_private(class, sizeof(PidginWebViewToolbarPriv));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1382
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1383 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/toolbar");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1384 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1385 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1386
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1387 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1388 pidgin_webviewtoolbar_create_actions(PidginWebViewToolbar *toolbar)
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1389 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1390 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1391 GtkActionGroup *action_group;
34308
cdb187c27360 Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34298
diff changeset
1392 gsize i;
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1393 struct {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1394 GtkAction **action;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1395 char *name;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1396 char *stock;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1397 char *label;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1398 char *tooltip;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1399 void (*cb)();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1400 gboolean toggle;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1401 } actions[] = {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1402 {&priv->bold, "ToggleBold", GTK_STOCK_BOLD, N_("<b>_Bold</b>"), N_("Bold"), do_bold, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1403 {&priv->italic, "ToggleItalic", GTK_STOCK_ITALIC, N_("<i>_Italic</i>"), N_("Italic"), do_italic, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1404 {&priv->underline, "ToggleUnderline", GTK_STOCK_UNDERLINE, N_("<u>_Underline</u>"), N_("Underline"), do_underline, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1405 {&priv->strike, "ToggleStrike", GTK_STOCK_STRIKETHROUGH, N_("<span strikethrough='true'>Strikethrough</span>"), N_("Strikethrough"), do_strikethrough, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1406 {&priv->larger_size, "ToggleLarger", PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, N_("<span size='larger'>Larger</span>"), N_("Increase Font Size"), do_big, FALSE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1407 #if 0
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1408 {&priv->normal_size, "ToggleNormal", NULL, N_("Normal"), N_("Normal Font Size"), NULL, FALSE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1409 #endif
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1410 {&priv->smaller_size, "ToggleSmaller", PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, N_("<span size='smaller'>Smaller</span>"), N_("Decrease Font Size"), do_small, FALSE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1411 {&priv->font, "ToggleFontFace", PIDGIN_STOCK_TOOLBAR_FONT_FACE, N_("_Font face"), N_("Font Face"), toggle_font, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1412 {&priv->fgcolor, "ToggleFG", PIDGIN_STOCK_TOOLBAR_FGCOLOR, N_("Foreground _color"), N_("Foreground Color"), toggle_fg_color, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1413 {&priv->bgcolor, "ToggleBG", PIDGIN_STOCK_TOOLBAR_BGCOLOR, N_("Bac_kground color"), N_("Background Color"), toggle_bg_color, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1414 {&priv->clear, "ResetFormat", PIDGIN_STOCK_CLEAR, N_("_Reset formatting"), N_("Reset Formatting"), clear_formatting_cb, FALSE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1415 {&priv->image, "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("_Image"), N_("Insert IM Image"), insert_image_cb, FALSE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1416 {&priv->link, "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("_Link"), N_("Insert Link"), insert_link_cb, TRUE},
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1417 {&priv->hr, "InsertHR", NULL, N_("_Horizontal rule"), N_("Insert Horizontal rule"), insert_hr_cb, FALSE},
33266
2188505ba110 Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33255
diff changeset
1418 {&priv->smiley, "InsertSmiley", PIDGIN_STOCK_TOOLBAR_SMILEY, N_("_Smile!"), N_("Insert Smiley"), insert_smiley_cb, TRUE},
34282
6de6ea85df26 Make Get/Send Attention strings consistent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34281
diff changeset
1419 {&priv->attention, "SendAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("_Attention!"), N_("Get Attention"), send_attention_cb, FALSE},
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1420 };
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1421
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1422 action_group = gtk_action_group_new("PidginWebViewToolbar");
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1423 #ifdef ENABLE_NLS
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1424 gtk_action_group_set_translation_domain(action_group, PACKAGE);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1425 #endif
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1426
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1427 for (i = 0; i < G_N_ELEMENTS(actions); i++) {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1428 GtkAction *action;
34281
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1429 if (actions[i].toggle) {
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1430 action = GTK_ACTION(gtk_toggle_action_new(
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1431 actions[i].name, _(actions[i].label),
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1432 _(actions[i].tooltip), actions[i].stock));
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1433 } else {
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1434 action = gtk_action_new(actions[i].name,
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1435 _(actions[i].label), _(actions[i].tooltip),
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1436 actions[i].stock);
ad957d0a467a Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34274
diff changeset
1437 }
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1438 gtk_action_set_is_important(action, TRUE);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1439 gtk_action_group_add_action(action_group, action);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1440 g_signal_connect(G_OBJECT(action), "activate", actions[i].cb, toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1441 *(actions[i].action) = action;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1442 }
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1443 }
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1444
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1445 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1446 pidgin_webviewtoolbar_create_wide_view(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1447 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1448 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1449 GtkAction *layout[] = {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1450 priv->bold,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1451 priv->italic,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1452 priv->underline,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1453 priv->strike,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1454 NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1455 priv->larger_size,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1456 #if 0
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1457 priv->normal_size,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1458 #endif
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1459 priv->smaller_size,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1460 NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1461 priv->font,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1462 priv->fgcolor,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1463 priv->bgcolor,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1464 NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1465 priv->clear,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1466 NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1467 priv->image,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1468 priv->link,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1469 NULL,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1470 priv->smiley,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1471 priv->attention
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1472 };
34308
cdb187c27360 Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34298
diff changeset
1473 gsize i;
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1474 GtkToolItem *item;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1475
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1476 priv->wide_view = gtk_toolbar_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1477 gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->wide_view),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1478 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1479 gtk_toolbar_set_style(GTK_TOOLBAR(priv->wide_view), GTK_TOOLBAR_ICONS);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1480
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1481 for (i = 0; i < G_N_ELEMENTS(layout); i++) {
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1482 if (layout[i])
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1483 item = GTK_TOOL_ITEM(gtk_action_create_tool_item(layout[i]));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1484 else
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1485 item = gtk_separator_tool_item_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1486 gtk_toolbar_insert(GTK_TOOLBAR(priv->wide_view), item, -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1487 }
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1488 }
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1489
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1490 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1491 pidgin_webviewtoolbar_create_lean_view(PidginWebViewToolbar *toolbar)
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1492 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1493 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1494 GtkWidget *label;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1495 GtkWidget *menuitem;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1496 GtkToolItem *sep;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1497 GtkToolItem *font_button;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1498 GtkWidget *font_menu;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1499 GtkToolItem *insert_button;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1500 GtkWidget *insert_menu;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1501 GtkWidget *smiley_button;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1502 GtkWidget *attention_button;
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1503
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1504 priv->lean_view = gtk_toolbar_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1505 gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->lean_view),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1506 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1507 gtk_toolbar_set_style(GTK_TOOLBAR(priv->lean_view), GTK_TOOLBAR_BOTH_HORIZ);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1508
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1509 #define ADD_MENU_ITEM(menu, item) \
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1510 menuitem = gtk_action_create_menu_item((item)); \
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1511 gtk_menu_shell_append(GTK_MENU_SHELL((menu)), menuitem);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1512
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1513 /* Fonts */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1514 font_button = gtk_toggle_tool_button_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1515 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), font_button, -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1516 gtk_tool_item_set_is_important(font_button, TRUE);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1517 gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(font_button), GTK_STOCK_BOLD);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1518 priv->font_label = label = gtk_label_new_with_mnemonic(_("_Font"));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1519 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1520 gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(font_button), label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1521
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1522 priv->font_menu = font_menu = gtk_menu_new();
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1523
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1524 ADD_MENU_ITEM(font_menu, priv->bold);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1525 ADD_MENU_ITEM(font_menu, priv->italic);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1526 ADD_MENU_ITEM(font_menu, priv->underline);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1527 ADD_MENU_ITEM(font_menu, priv->strike);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1528 ADD_MENU_ITEM(font_menu, priv->larger_size);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1529 #if 0
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1530 ADD_MENU_ITEM(font_menu, priv->normal_size);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1531 #endif
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1532 ADD_MENU_ITEM(font_menu, priv->smaller_size);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1533 ADD_MENU_ITEM(font_menu, priv->font);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1534 ADD_MENU_ITEM(font_menu, priv->fgcolor);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1535 ADD_MENU_ITEM(font_menu, priv->bgcolor);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1536 ADD_MENU_ITEM(font_menu, priv->clear);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1537
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1538 g_signal_connect(G_OBJECT(font_button), "toggled",
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1539 G_CALLBACK(pidgin_menu_clicked), font_menu);
33196
e3d6afee499c Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33149
diff changeset
1540 g_signal_connect_object(G_OBJECT(font_menu), "deactivate",
e3d6afee499c Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33149
diff changeset
1541 G_CALLBACK(pidgin_menu_deactivate), font_button, 0);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1542
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1543 gtk_container_foreach(GTK_CONTAINER(font_menu), enable_markup, NULL);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1544
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1545 /* Sep */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1546 sep = gtk_separator_tool_item_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1547 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1548
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1549 /* Insert */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1550 insert_button = gtk_toggle_tool_button_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1551 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), insert_button, -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1552 gtk_tool_item_set_is_important(insert_button, TRUE);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1553 gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(insert_button),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1554 PIDGIN_STOCK_TOOLBAR_INSERT);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1555 label = gtk_label_new_with_mnemonic(_("_Insert"));
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1556 gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(insert_button), label);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1557
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1558 priv->insert_menu = insert_menu = gtk_menu_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1559
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1560 ADD_MENU_ITEM(insert_menu, priv->image);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1561 ADD_MENU_ITEM(insert_menu, priv->link);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1562 ADD_MENU_ITEM(insert_menu, priv->hr);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1563
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1564 g_signal_connect(G_OBJECT(insert_button), "toggled",
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1565 G_CALLBACK(pidgin_menu_clicked), insert_menu);
33196
e3d6afee499c Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33149
diff changeset
1566 g_signal_connect_object(G_OBJECT(insert_menu), "deactivate",
e3d6afee499c Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33149
diff changeset
1567 G_CALLBACK(pidgin_menu_deactivate), insert_button, 0);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1568
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1569 /* Sep */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1570 sep = gtk_separator_tool_item_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1571 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1572
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1573 /* Smiley */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1574 smiley_button = gtk_action_create_tool_item(priv->smiley);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1575 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1576 GTK_TOOL_ITEM(smiley_button), -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1577
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1578 /* Sep */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1579 sep = gtk_separator_tool_item_new();
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1580 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1581
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1582 /* Attention */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1583 attention_button = gtk_action_create_tool_item(priv->attention);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1584 gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1585 GTK_TOOL_ITEM(attention_button), -1);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1586
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1587 #undef ADD_MENU_ITEM
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1588 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1589
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1590 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1591 pidgin_webviewtoolbar_init(PidginWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1592 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1593 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1594 GtkWidget *hbox = GTK_WIDGET(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1595
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1596 if (resources_ref_cnt++ == 0) {
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1597 color_parse_rgb = g_regex_new("^rgb\\s*\\(\\s*"
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1598 "([0-9]+),\\s*([0-9]+),\\s*([0-9]+)\\s*\\)",
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1599 G_REGEX_OPTIMIZE, 0, NULL);
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1600 }
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1601
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1602 pidgin_webviewtoolbar_create_actions(toolbar);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1603 pidgin_webviewtoolbar_create_wide_view(toolbar);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1604 pidgin_webviewtoolbar_create_lean_view(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1605
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1606 gtk_box_pack_start(GTK_BOX(hbox), priv->wide_view, TRUE, TRUE, 0);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1607 gtk_box_pack_start(GTK_BOX(hbox), priv->lean_view, TRUE, TRUE, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1608
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1609 priv->sml = NULL;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1610
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1611 /* set attention button to be greyed out until we get a conversation */
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1612 gtk_action_set_sensitive(priv->attention, FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1613
34283
800cf8ff15f8 Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34282
diff changeset
1614 gtk_action_set_sensitive(priv->smiley,
35094
47964e26263e Assorted whitespace fixes.
Mark Doliner <mark@kingant.net>
parents: 35029
diff changeset
1615 pidgin_themes_get_proto_smileys(NULL) != NULL);
34283
800cf8ff15f8 Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34282
diff changeset
1616
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1617 purple_prefs_connect_callback(toolbar,
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1618 PIDGIN_PREFS_ROOT "/conversations/toolbar/wide",
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1619 webviewtoolbar_view_pref_changed, toolbar);
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1620 g_signal_connect_data(G_OBJECT(toolbar), "realize",
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1621 G_CALLBACK(purple_prefs_trigger_callback),
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1622 PIDGIN_PREFS_ROOT "/conversations/toolbar/wide",
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1623 NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1624
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1625 g_signal_connect(G_OBJECT(hbox), "button-press-event",
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1626 G_CALLBACK(pidgin_webviewtoolbar_popup_menu), toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1627 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1628
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1629 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1630 * Public API
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1631 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1632
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1633 GtkWidget *
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1634 pidgin_webviewtoolbar_new(void)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1635 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1636 return GTK_WIDGET(g_object_new(pidgin_webviewtoolbar_get_type(), NULL));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1637 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1638
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1639 GType
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1640 pidgin_webviewtoolbar_get_type(void)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1641 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1642 static GType webviewtoolbar_type = 0;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1643
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1644 if (!webviewtoolbar_type) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1645 static const GTypeInfo webviewtoolbar_info = {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1646 sizeof(PidginWebViewToolbarClass),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1647 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1648 NULL,
35552
0497dd67473c Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35547
diff changeset
1649 pidgin_webviewtoolbar_class_init,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1650 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1651 NULL,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1652 sizeof(PidginWebViewToolbar),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1653 0,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1654 (GInstanceInitFunc)pidgin_webviewtoolbar_init,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1655 NULL
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1656 };
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1657
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1658 webviewtoolbar_type = g_type_register_static(GTK_TYPE_HBOX,
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1659 "PidginWebViewToolbar", &webviewtoolbar_info, 0);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1660 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1661
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1662 return webviewtoolbar_type;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1663 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1664
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1665 void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1666 pidgin_webviewtoolbar_attach(PidginWebViewToolbar *toolbar, GtkWidget *webview)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1667 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1668 PidginWebViewButtons buttons;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1669
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1670 g_return_if_fail(toolbar != NULL);
35506
4252b2882889 Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents: 35500
diff changeset
1671 g_return_if_fail(PIDGIN_IS_WEBVIEWTOOLBAR(toolbar));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1672 g_return_if_fail(webview != NULL);
35506
4252b2882889 Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents: 35500
diff changeset
1673 g_return_if_fail(PIDGIN_IS_WEBVIEW(webview));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1674
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1675 toolbar->webview = webview;
32814
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1676 g_signal_connect(G_OBJECT(webview), "allowed-formats-updated",
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1677 G_CALLBACK(update_buttons_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1678 g_signal_connect_after(G_OBJECT(webview), "format-toggled",
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1679 G_CALLBACK(toggle_button_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1680 g_signal_connect_after(G_OBJECT(webview), "format-cleared",
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1681 G_CALLBACK(update_format_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1682 g_signal_connect(G_OBJECT(webview), "format-updated",
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1683 G_CALLBACK(update_format_cb), toolbar);
33029
5005e63a35d4 Update the toolbar when the caret moves.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33023
diff changeset
1684 g_signal_connect_after(G_OBJECT(webview), "selection-changed",
5005e63a35d4 Update the toolbar when the caret moves.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33023
diff changeset
1685 G_CALLBACK(mark_set_cb), toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1686
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1687 buttons = pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(webview));
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1688 update_buttons_cb(PIDGIN_WEBVIEW(webview), buttons, toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1689 update_buttons(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1690 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1691
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1692 void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1693 pidgin_webviewtoolbar_associate_smileys(PidginWebViewToolbar *toolbar,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1694 const char *proto_id)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1695 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1696 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1697 g_free(priv->sml);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1698 priv->sml = g_strdup(proto_id);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1699 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1700
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1701 void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1702 pidgin_webviewtoolbar_switch_active_conversation(PidginWebViewToolbar *toolbar,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1703 PurpleConversation *conv)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1704 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1705 PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1706 PurpleConnection *gc = purple_conversation_get_connection(conv);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1707 PurplePlugin *prpl = purple_connection_get_prpl(gc);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1708
32819
9d3b96bd2923 Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32818
diff changeset
1709 priv->active_conv = conv;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1710
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1711 /* gray out attention button on protocols that don't support it
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1712 for the time being it is always disabled for chats */
33015
20fdd5e3f446 Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33014
diff changeset
1713 gtk_action_set_sensitive(priv->attention,
34662
f14347f38e3b Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
1714 conv && prpl && PURPLE_IS_IM_CONVERSATION(conv) &&
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1715 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL);
34283
800cf8ff15f8 Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34282
diff changeset
1716
800cf8ff15f8 Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34282
diff changeset
1717 gtk_action_set_sensitive(priv->smiley,
35029
f9f672dcaadf Fixed warnings
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
1718 pidgin_themes_get_proto_smileys(priv->sml) != NULL);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1719 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1720
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1721 void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1722 pidgin_webviewtoolbar_activate(PidginWebViewToolbar *toolbar,
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1723 PidginWebViewAction action)
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1724 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1725 PidginWebViewToolbarPriv *priv;
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1726 GtkAction *act;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1727
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1728 g_return_if_fail(toolbar != NULL);
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1729
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1730 priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1731 switch (action) {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1732 case PIDGIN_WEBVIEW_ACTION_BOLD:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1733 act = priv->bold;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1734 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1735
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1736 case PIDGIN_WEBVIEW_ACTION_ITALIC:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1737 act = priv->italic;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1738 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1739
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1740 case PIDGIN_WEBVIEW_ACTION_UNDERLINE:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1741 act = priv->underline;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1742 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1743
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1744 case PIDGIN_WEBVIEW_ACTION_STRIKE:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1745 act = priv->strike;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1746 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1747
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1748 case PIDGIN_WEBVIEW_ACTION_LARGER:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1749 act = priv->larger_size;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1750 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1751
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1752 #if 0
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1753 case PIDGIN_WEBVIEW_ACTION_NORMAL:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1754 act = priv->normal_size;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1755 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1756 #endif
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1757
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1758 case PIDGIN_WEBVIEW_ACTION_SMALLER:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1759 act = priv->smaller_size;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1760 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1761
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1762 case PIDGIN_WEBVIEW_ACTION_FONTFACE:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1763 act = priv->font;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1764 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1765
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1766 case PIDGIN_WEBVIEW_ACTION_FGCOLOR:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1767 act = priv->fgcolor;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1768 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1769
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1770 case PIDGIN_WEBVIEW_ACTION_BGCOLOR:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1771 act = priv->bgcolor;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1772 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1773
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1774 case PIDGIN_WEBVIEW_ACTION_CLEAR:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1775 act = priv->clear;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1776 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1777
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1778 case PIDGIN_WEBVIEW_ACTION_IMAGE:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1779 act = priv->image;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1780 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1781
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1782 case PIDGIN_WEBVIEW_ACTION_LINK:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1783 act = priv->link;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1784 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1785
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1786 case PIDGIN_WEBVIEW_ACTION_HR:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1787 act = priv->hr;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1788 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1789
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1790 case PIDGIN_WEBVIEW_ACTION_SMILEY:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1791 act = priv->smiley;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1792 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1793
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1794 case PIDGIN_WEBVIEW_ACTION_ATTENTION:
33255
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1795 act = priv->attention;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1796 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1797
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1798 default:
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1799 g_return_if_reached();
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1800 break;
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1801 }
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1802
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1803 gtk_action_activate(act);
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1804 }
0c8cfc86bdc2 Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33196
diff changeset
1805

mercurial