pidgin/gtkwebviewtoolbar.c

Sun, 03 Jun 2012 21:13:19 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 03 Jun 2012 21:13:19 +0000
changeset 33014
2f8a83007ab9
parent 33013
f62232fb738a
child 33015
20fdd5e3f446
permissions
-rw-r--r--

Set up the link description from the already selected text.

32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 * @file gtkwebviewtoolbar.c GTK+ WebView Toolbar
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 * @ingroup pidgin
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
5
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 /* pidgin
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * 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
9 * 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
10 * source distribution.
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 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
13 * 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
14 * 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
15 * (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
16 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 * 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
18 * 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
19 * 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
20 * 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
21 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22 * 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
23 * 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
24 * 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
25 *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27 #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
28 #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
29
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
30 #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
31 #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
32 #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
33 #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
34 #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
35 #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
36 #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
37
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
38 #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
39 #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
40 #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
41 #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
42 #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
43
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
44 #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
45
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
46 #if !GTK_CHECK_VERSION(2,18,0)
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
47 #define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE((x))
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
48 #define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE((x))
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
49 #if !GTK_CHECK_VERSION(2,12,0)
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
50 #define gtk_widget_set_tooltip_text(w, t) \
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
51 gtk_tooltips_set_tip(priv->tooltips, (w), (t), NULL)
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
52 #endif
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
53 #endif
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
54
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
55 #define GTK_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
56 (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarPriv))
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
57
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
58 /******************************************************************************
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
59 * Structs
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
60 *****************************************************************************/
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
61
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
62 typedef struct _GtkWebViewToolbarPriv {
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
63 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
64
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
65 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
66 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
67
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
68 #if !GTK_CHECK_VERSION(2,12,0)
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
69 GtkTooltips *tooltips;
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
70 #endif
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
71
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
72 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
73 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
74
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
75 GtkWidget *bold;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
76 GtkWidget *italic;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
77 GtkWidget *underline;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
78 GtkWidget *strike;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
79
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
80 GtkWidget *larger_size;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
81 GtkWidget *normal_size;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
82 GtkWidget *smaller_size;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
83
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
84 GtkWidget *font;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
85 GtkWidget *fgcolor;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
86 GtkWidget *bgcolor;
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 *clear;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
89
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
90 GtkWidget *insert_menu;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
91 GtkWidget *image;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
92 GtkWidget *link;
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
93 GtkWidget *insert_hr;
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
94
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
95 GtkWidget *smiley;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
96 GtkWidget *attention;
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
97 GtkWidget *call;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
98
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
99 GtkWidget *font_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
100 GtkWidget *fgcolor_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
101 GtkWidget *bgcolor_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
102 GtkWidget *link_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
103 GtkWidget *smiley_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
104 GtkWidget *image_dialog;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
105
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
106 char *sml;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
107 } GtkWebViewToolbarPriv;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
108
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
109 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
110 * Globals
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
111 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
112
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
113 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
114
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
115 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
116 * Prototypes
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
117 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
118
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
119 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
120 toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
121 GtkWebViewToolbar *toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
122
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
123 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
124 gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
125 GtkWebViewToolbar *toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
126
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
127 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
128 * Helpers
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
129 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
130
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
131 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
132 do_bold(GtkWidget *bold, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
133 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
134 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
135 gtk_webview_toggle_bold(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
136 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
137 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
138
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
139 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
140 do_italic(GtkWidget *italic, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
141 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
142 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
143 gtk_webview_toggle_italic(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
144 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
145 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
146
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
147 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
148 do_underline(GtkWidget *underline, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
149 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
150 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
151 gtk_webview_toggle_underline(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
152 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
153 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
154
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
155 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
156 do_strikethrough(GtkWidget *strikethrough, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
157 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
158 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
159 gtk_webview_toggle_strike(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
160 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
161 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
162
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
163 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
164 do_small(GtkWidget *smalltb, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
165 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
166 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
167 /* Only shrink the font on activation, not deactivation as well */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
168 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb)))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
169 gtk_webview_font_shrink(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
170 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
171 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
172
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
173 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
174 do_big(GtkWidget *large, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
175 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
176 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
177 /* Only grow the font on activation, not deactivation as well */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
178 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large)))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
179 gtk_webview_font_grow(GTK_WEBVIEW(toolbar->webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
180 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
181 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
182
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
183 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
184 destroy_toolbar_font(GtkWidget *widget, GdkEvent *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
185 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
187 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
188
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
189 if (widget != NULL)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
190 gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview), "");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
191
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
192 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
193 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
194 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
195 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
196 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
197
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
198 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
199 }
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 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
202 realize_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
203 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
204 GtkWebViewToolbarPriv *priv = GTK_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
205 GtkFontSelection *sel;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
206
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
207 sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->fontsel);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
208 gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
209 gtk_widget_show_all(sel->family_list);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
210 gtk_widget_show(gtk_widget_get_parent(sel->family_list));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
211 gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list)));
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
214 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
215 cancel_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar)
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 destroy_toolbar_font(widget, NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
218 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
219
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
220 static void
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
221 apply_font(GtkWidget *widget, GtkWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
222 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
223 /* 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
224 but for now only works with font face */
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
225 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
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
226 GtkFontSelectionDialog *fontsel = GTK_FONT_SELECTION_DIALOG(priv->font_dialog);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
227 gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel);
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 if (fontname) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
230 const gchar *family_name = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
231 PangoFontDescription *desc = NULL;
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 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
234 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
235
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
236 if (family_name) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
237 gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
238 family_name);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
239 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
240
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
241 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
242 g_free(fontname);
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 cancel_toolbar_font(NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
246 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
247
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
248 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
249 toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
250 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
251 GtkWebViewToolbarPriv *priv;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
252 g_return_if_fail(toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
253 priv = GTK_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
254
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
255 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) {
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
256 char *fontname = gtk_webview_get_current_fontface(GTK_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
257
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
258 if (!priv->font_dialog) {
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
259 priv->font_dialog = gtk_font_selection_dialog_new(_("Select Font"));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
260
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
261 if (fontname) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
262 char *fonttif = g_strdup_printf("%s 12", fontname);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
263 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(priv->font_dialog),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
264 fonttif);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
265 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
266 } else {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
267 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(priv->font_dialog),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
268 DEFAULT_FONT_FACE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
269 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
270
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
271 g_signal_connect(G_OBJECT(priv->font_dialog), "delete_event",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
272 G_CALLBACK(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
273 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->ok_button), "clicked",
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
274 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
275 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->cancel_button), "clicked",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
276 G_CALLBACK(cancel_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
277 g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
278 G_CALLBACK(realize_toolbar_font), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
279 }
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
280
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
281 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
282
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
283 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
284 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
285 cancel_toolbar_font(font, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
286 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
287
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
288 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
289 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
290
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
291 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
292 destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
293 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
294 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
295 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
296
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
297 if (widget != NULL)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
298 gtk_webview_toggle_forecolor(GTK_WEBVIEW(toolbar->webview), "");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
299
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
300 if (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
301 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
302 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
303 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
304 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
305
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
306 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
307 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
308
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
309 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
310 cancel_toolbar_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
311 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
312 destroy_toolbar_fgcolor(widget, NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
313 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
314
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
315 static void
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
316 do_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
317 {
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
318 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
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
319 GtkColorSelectionDialog *dialog;
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
320 GtkColorSelection *colorsel;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
321 GdkColor text_color;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
322 char *open_tag;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
323
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
324 dialog = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog);
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 colorsel = GTK_COLOR_SELECTION(dialog->colorsel);
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
326
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
327 open_tag = g_malloc(30);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
328 gtk_color_selection_get_current_color(colorsel, &text_color);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
329 g_snprintf(open_tag, 23, "#%02X%02X%02X",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
330 text_color.red / 256,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
331 text_color.green / 256,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
332 text_color.blue / 256);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
333 gtk_webview_toggle_forecolor(GTK_WEBVIEW(toolbar->webview), open_tag);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
334 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
335
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
336 cancel_toolbar_fgcolor(NULL, toolbar);
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
339 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
340 toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
341 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
342 GtkWebViewToolbarPriv *priv = GTK_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
343 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
344 GtkWidget *colorsel;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
345 GdkColor fgcolor;
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
346 char *color = gtk_webview_get_current_forecolor(GTK_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
347
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
348 if (!priv->fgcolor_dialog) {
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
349 priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
350 colorsel = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->colorsel;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
351 if (color) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
352 gdk_color_parse(color, &fgcolor);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
353 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
354 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
355
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
356 g_signal_connect(G_OBJECT(priv->fgcolor_dialog), "delete_event",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
357 G_CALLBACK(destroy_toolbar_fgcolor), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
358 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->ok_button), "clicked",
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
359 G_CALLBACK(do_fgcolor), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
360 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->cancel_button), "clicked",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
361 G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
362 }
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
363
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
364 gtk_window_present(GTK_WINDOW(priv->fgcolor_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
365
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
366 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
367 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
368 cancel_toolbar_fgcolor(color, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
369 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
370
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
371 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
372 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
373
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
374 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
375 destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
376 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
377 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
378 GtkWebViewToolbarPriv *priv = GTK_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
379 if (widget != NULL) {
32896
a9cbf3a55393 Having a backcolor and a background seems a bit redundant. And we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32895
diff changeset
380 gtk_webview_toggle_backcolor(GTK_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
381 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
382
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
383 if (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
384 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
385 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
386 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
387 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
388
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
389 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
390 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
391
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
392 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
393 cancel_toolbar_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
394 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
395 destroy_toolbar_bgcolor(widget, NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
396 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
397
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
398 static void
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
399 do_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar)
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
400 {
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
401 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
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
402 GtkColorSelectionDialog *dialog;
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
403 GtkColorSelection *colorsel;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
404 GdkColor text_color;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
405 char *open_tag;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
406
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
407 dialog = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog);
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
408 colorsel = GTK_COLOR_SELECTION(dialog->colorsel);
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
409
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
410 open_tag = g_malloc(30);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
411 gtk_color_selection_get_current_color(colorsel, &text_color);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
412 g_snprintf(open_tag, 23, "#%02X%02X%02X",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
413 text_color.red / 256,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
414 text_color.green / 256,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
415 text_color.blue / 256);
32896
a9cbf3a55393 Having a backcolor and a background seems a bit redundant. And we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32895
diff changeset
416 gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), 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
417 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
418
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
419 cancel_toolbar_bgcolor(NULL, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
420 }
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 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
423 toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
424 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
425 GtkWebViewToolbarPriv *priv = GTK_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
426 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
427 GtkWidget *colorsel;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
428 GdkColor bgcolor;
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
429 char *color = gtk_webview_get_current_backcolor(GTK_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
430
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
431 if (!priv->bgcolor_dialog) {
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
432 priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color"));
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
433 colorsel = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->colorsel;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
434 if (color) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
435 gdk_color_parse(color, &bgcolor);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
436 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
437 }
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 g_signal_connect(G_OBJECT(priv->bgcolor_dialog), "delete_event",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
440 G_CALLBACK(destroy_toolbar_bgcolor), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
441 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->ok_button), "clicked",
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
442 G_CALLBACK(do_bgcolor), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
443 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->cancel_button), "clicked",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
444 G_CALLBACK(cancel_toolbar_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
445 }
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
446
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
447 gtk_window_present(GTK_WINDOW(priv->bgcolor_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
448
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
449 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
450 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
451 cancel_toolbar_bgcolor(color, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
452 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
453
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
454 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
455 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
456
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
457 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
458 clear_formatting_cb(GtkWidget *clear, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
459 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
460 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
461 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->clear), FALSE, 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 gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview));
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
465 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
466 cancel_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
467 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
468 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
469 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(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
470
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
471 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
472 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
473
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
474 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
475 close_link_dialog(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
476 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
477 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
478 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
479 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
480 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
481 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
482 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
483 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
484
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
485 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
486 do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
487 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
488 GtkWebViewToolbarPriv *priv = GTK_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
489 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
490
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
491 url = purple_request_fields_get_string(fields, "url");
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
492 if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
493 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
494 else
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
495 description = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
496
33013
f62232fb738a Restore "Insert Link" functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33012
diff changeset
497 gtk_webview_insert_link(GTK_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
498
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
499 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(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
500
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
501 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
502 }
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 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
505 insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
506 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
507 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
508 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(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
509 PurpleRequestFields *fields;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
510 PurpleRequestFieldGroup *group;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
511 PurpleRequestField *field;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
512 char *msg;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
513 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
514
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
515 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
516
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
517 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
518 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
519
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
520 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
521 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
522 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
523
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
524 if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC) {
33014
2f8a83007ab9 Set up the link description from the already selected text.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33013
diff changeset
525 desc = gtk_webview_get_selected_text(GTK_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
526 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
527 desc, FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
528 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
529 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
530 "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
531 "is optional."));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
532 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
533 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
534 "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
535 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
536
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
537 priv->link_dialog =
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
538 purple_request_fields(toolbar, _("Insert Link"),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
539 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
540 msg,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
541 fields,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
542 _("_Insert"), G_CALLBACK(do_insert_link_cb),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
543 _("Cancel"), G_CALLBACK(cancel_link_cb),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
544 NULL, NULL, NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
545 toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
546 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
547 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
548 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
549 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
550 }
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
551
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
552 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
553 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
554
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
555 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
556 insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
557 {
33012
3a742f00a0f4 Restore Insert Horizontal Rule functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32896
diff changeset
558 gtk_webview_insert_hr(GTK_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
559 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
560
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
561 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
562 do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
563 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
564 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
565 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
566 #if 0
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
567 gchar *filename, *name, *buf;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
568 char *filedata;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
569 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
570 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
571 int id;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
572 GtkTextIter iter;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
573 GtkTextMark *ins;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
574
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
575 if (response != GTK_RESPONSE_ACCEPT)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
576 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
577 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
578 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
579 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
580
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
581 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
582
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
583 if (filename == NULL) {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
584 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
585 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
586 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
587
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
588 /* The following triggers a callback that closes the widget */
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
589 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
590
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
591 if (!g_file_get_contents(filename, &filedata, &size, &error)) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
592 purple_notify_error(NULL, NULL, error->message, NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
593
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
594 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
595 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
596
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
597 return;
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
600 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
601
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
602 id = purple_imgstore_add_with_id(filedata, size, name);
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 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
605 buf = g_strdup_printf(_("Failed to store image: %s\n"), filename);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
606 purple_notify_error(NULL, NULL, buf, NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
607
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
608 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
609 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
610
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
611 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
612 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
613
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
614 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
615
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
616 ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
617 gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
618 &iter, ins);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
619 gtk_webview_insert_image_at_iter(GTK_WEBVIEW(toolbar->webview), id, &iter);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
620 purple_imgstore_unref_by_id(id);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
621 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
622 }
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 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
625 insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
626 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
627 GtkWebViewToolbarPriv *priv = GTK_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
628 GtkWidget *window;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
629
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
630 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(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
631 window = gtk_file_chooser_dialog_new(_("Insert Image"),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
632 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
633 GTK_FILE_CHOOSER_ACTION_OPEN,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
634 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
635 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
636 NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
637 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
638 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
639 "response", G_CALLBACK(do_insert_image_cb), toolbar);
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 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
642 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
643 } else {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
644 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
645 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
646 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
647
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
648 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
649 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
650
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
651 #if 0
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
652 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
653 destroy_smiley_dialog(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
654 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
655 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
656 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
657 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
658 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
659 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
660 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
661 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
662
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
663 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
664 close_smiley_dialog(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
665 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
666 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
667 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(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
668 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
669 }
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
672 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
673 insert_smiley_text(GtkWidget *widget, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
674 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
675 GtkWebViewToolbarPriv *priv = GTK_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
676 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
677
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
678 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
679 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
680
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
681 gtk_webview_insert_smiley(GTK_WEBVIEW(toolbar->webview),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
682 GTK_WEBVIEW(toolbar->webview)->protocol_name,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
683 escaped_smiley);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
684
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
685 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
686
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
687 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
688 }
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 /* 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
691 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
692 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
693 GtkWidget *button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
694 const GtkIMHtmlSmiley *smiley;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
695 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
696 };
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
697
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
698 static 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
699 sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
700 int *width, const GtkIMHtmlSmiley *smiley)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
701 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
702 GtkWebViewToolbarPriv *priv = GTK_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
703 GtkWidget *image;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
704 GtkWidget *button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
705 GtkRequisition size;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
706 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
707 struct smiley_button_list *it, *it_last;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
708 const gchar *filename = smiley->file;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
709 gchar *face = smiley->smile;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
710 PurpleSmiley *psmiley = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
711 gboolean supports_custom = (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_CUSTOM_SMILEY);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
712
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
713 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
714 it = ls;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
715 it_last = ls; /* list iterators*/
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
716 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
717
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
718 gtk_widget_size_request(image, &size);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
719
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
720 if (size.width > 24 &&
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
721 smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM) { /* This is a custom smiley, let's scale it */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
722 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
723 GtkImageType type;
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 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
726
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
727 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
728 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
729 } 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
730 GdkPixbufAnimation *animation;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
731
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
732 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
733
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
734 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
735 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
736
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
737 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
738 GdkPixbuf *resized;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
739 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
740 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
741
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
742 gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
743 gtk_widget_size_request(image, &size);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
744 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
745 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
746 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
747
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
748 (*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
749
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
750 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
751 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
752
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
753 g_object_set_data(G_OBJECT(button), "smiley_text", face);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
754 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
755
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
756 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
757
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
758 /* 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
759 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
760
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
761 psmiley = purple_smileys_find_by_shortcut(smiley->smile);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
762 /* 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
763 "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
764 is custom smiley-enabled */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
765 if (supports_custom && psmiley && !(smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM)) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
766 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
767 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
768 _("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
769 face);
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
770 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
771 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
772 } 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
773 /* 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
774 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
775 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
776 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
777
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
778 /* 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
779 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
780 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
781 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
782 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
783 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
784
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
785 /* 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
786 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
787 return cur;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
788 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
789 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
790 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
791 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
792 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
793 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
794 return ls;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
795 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
796
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
797 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
798 smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
799 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
800 GtkWebViewToolbarPriv *priv = GTK_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
801 while (list) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
802 GtkIMHtmlSmiley *cur = (GtkIMHtmlSmiley *) list->data;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
803 if (!strcmp(cur->file, smiley->file))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
804 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
805 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
806 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
807 return TRUE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
808 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
809
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
810 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
811 smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
812 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
813 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
814 if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
815 (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
816 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
817 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
818 return TRUE;
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
821 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
822 }
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 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
825 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
826 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
827 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
828 GtkWidget *line;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
829 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
830
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
831 if (!list)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
832 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
833
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
834 line = gtk_hbox_new(FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
835 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
836 for (; list; 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
837 if (custom != !!(list->smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
838 continue;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
839 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
840 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
841 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
842 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
843 if (list->next) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
844 line = gtk_hbox_new(FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
845 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
846 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
847 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
848 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
849 }
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 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
852
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
853 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
854 insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar)
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 #if 0
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
857 GtkWebViewToolbarPriv *priv = GTK_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
858 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
859 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
860 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
861 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
862 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
863 GtkRequisition req;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
864 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
865
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
866 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
867 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
868 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
869 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
870 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
871
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
872 if (priv->sml)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
873 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
874 else
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
875 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
876
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
877 /* Note: prepend smileys to list to avoid O(n^2) overhead when there is
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
878 a large number of smileys... need to revers the list after for the dialog
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
879 work... */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
880 while(smileys) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
881 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) smileys->data;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
882 if(!smiley->hidden) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
883 if(smiley_is_unique(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
884 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
885 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
886 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
887 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
888 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
889 supports_custom = (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_CUSTOM_SMILEY);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
890 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
891 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
892 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
893
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
894 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
895 iterator = g_slist_next(iterator)) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
896 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) iterator->data;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
897 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
898 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
899 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
900
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
901 /* 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
902 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
903
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
904 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
905 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
906 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
907
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
908 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
909 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
910 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
911
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
912 /* 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
913 ls = NULL;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
914 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
915 num_lines = floor(sqrt(g_slist_length(unique_smileys)));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
916 smiley_table = gtk_vbox_new(FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
917
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
918 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
919 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
920 GtkRequisition req;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
921 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
922 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
923 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
924 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
925 gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
926 gtk_widget_size_request(manage, &req);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
927 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
928 }
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 /* 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
931 while (unique_smileys) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
932 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) unique_smileys->data;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
933 if (!smiley->hidden) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
934 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
935 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
936 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
937 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
938 /* 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
939 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
940
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
941 /* 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
942 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
943 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
944 gtk_box_pack_start(GTK_BOX(smiley_table), gtk_hseparator_new(), TRUE, FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
945 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
946 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
947 while (ls) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
948 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
949 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
950 ls = tmp;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
951 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
952
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
953 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
954 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
955 else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
956 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
957 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
958 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
959 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
960
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 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
963 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
964 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
965
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
966 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
967 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
968
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
969 /* connect signals */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
970 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
971 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
972
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
973 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
974 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
975
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
976 /* show everything */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
977 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
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_size_request(viewport, &req);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
980 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
981
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
982 /* 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
983 * 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
984 * 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
985 * 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
986 * 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
987 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
988 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
989 "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
990 "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
991 NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
992
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
993 #ifdef _WIN32
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
994 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
995 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
996
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
997 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
998
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
999 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
1000 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1001 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1002
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1003 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1004 send_attention_cb(GtkWidget *attention, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1005 {
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
1006 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
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
1007 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
1008 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
1009 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
1010
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1011 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1012 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
1013 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
1014 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1015
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1016 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1017 update_buttons_cb(GtkWebView *webview, GtkWebViewButtons buttons,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1018 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1019 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1020 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1021 gtk_widget_set_sensitive(GTK_WIDGET(priv->bold), buttons & GTK_WEBVIEW_BOLD);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1022 gtk_widget_set_sensitive(GTK_WIDGET(priv->italic), buttons & GTK_WEBVIEW_ITALIC);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1023 gtk_widget_set_sensitive(GTK_WIDGET(priv->underline), buttons & GTK_WEBVIEW_UNDERLINE);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1024 gtk_widget_set_sensitive(GTK_WIDGET(priv->strike), buttons & GTK_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
1025
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1026 gtk_widget_set_sensitive(GTK_WIDGET(priv->larger_size), buttons & GTK_WEBVIEW_GROW);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1027 gtk_widget_set_sensitive(GTK_WIDGET(priv->smaller_size), buttons & GTK_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
1028
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1029 gtk_widget_set_sensitive(GTK_WIDGET(priv->font), buttons & GTK_WEBVIEW_FACE);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1030 gtk_widget_set_sensitive(GTK_WIDGET(priv->fgcolor), buttons & GTK_WEBVIEW_FORECOLOR);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1031 gtk_widget_set_sensitive(GTK_WIDGET(priv->bgcolor), buttons & GTK_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
1032
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1033 gtk_widget_set_sensitive(GTK_WIDGET(priv->clear),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1034 (buttons & GTK_WEBVIEW_BOLD ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1035 buttons & GTK_WEBVIEW_ITALIC ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1036 buttons & GTK_WEBVIEW_UNDERLINE ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1037 buttons & GTK_WEBVIEW_STRIKE ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1038 buttons & GTK_WEBVIEW_GROW ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1039 buttons & GTK_WEBVIEW_SHRINK ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1040 buttons & GTK_WEBVIEW_FACE ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1041 buttons & GTK_WEBVIEW_FORECOLOR ||
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1042 buttons & GTK_WEBVIEW_BACKCOLOR));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1043
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1044 gtk_widget_set_sensitive(GTK_WIDGET(priv->image), buttons & GTK_WEBVIEW_IMAGE);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1045 gtk_widget_set_sensitive(GTK_WIDGET(priv->link), buttons & GTK_WEBVIEW_LINK);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1046 gtk_widget_set_sensitive(GTK_WIDGET(priv->smiley), buttons & GTK_WEBVIEW_SMILEY);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1047 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1048
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1049 /* we call this when we want to _set_active the toggle button, it'll
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1050 * block the callback thats connected to the button so we don't have to
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1051 * 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
1052 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1053 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1054 toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1055 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1056 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1057 GObject *object;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1058 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
1059
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1060 object = g_object_ref(button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1061 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1062 0, 0, 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
1063 gtk_toggle_button_set_active(button, is_active);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1064 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1065 0, 0, 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
1066 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
1067 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1068
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1069 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1070 update_buttons(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1071 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1072 GtkWebViewToolbarPriv *priv = GTK_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
1073 gboolean bold, italic, underline, strike;
32896
a9cbf3a55393 Having a backcolor and a background seems a bit redundant. And we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32895
diff changeset
1074 char *tmp;
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
1075 GtkLabel *label = GTK_LABEL(priv->font_label);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1076
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1077 gtk_label_set_label(label, _("_Font"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1078
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1079 gtk_webview_get_current_format(GTK_WEBVIEW(toolbar->webview),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1080 &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
1081
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1082 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->bold)) != bold)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1083 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bold), bold,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1084 toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1085 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->italic)) != italic)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1086 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->italic), italic,
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1087 toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1088 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->underline)) != underline)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1089 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->underline),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1090 underline, toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1091 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->strike)) != strike)
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1092 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->strike),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1093 strike, toolbar);
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 /* These buttons aren't ever "active". */
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1096 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->smaller_size), FALSE);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1097 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->larger_size), FALSE);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1098
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1099 if (bold) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1100 gchar *markup = g_strdup_printf("<b>%s</b>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1101 gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1102 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1103 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1104 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1105 if (italic) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1106 gchar *markup = g_strdup_printf("<i>%s</i>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1107 gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1108 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1109 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1110 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1111 if (underline) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1112 gchar *markup = g_strdup_printf("<u>%s</u>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1113 gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1114 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1115 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1116 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1117 if (strike) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1118 gchar *markup = g_strdup_printf("<s>%s</s>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1119 gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1120 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1121 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1122 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1123
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1124 tmp = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1125 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->font),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1126 (tmp != NULL), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1127 if (tmp != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1128 gchar *markup = g_strdup_printf("<span font_desc=\"%s\">%s</span>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1129 tmp, gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1130 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1131 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1132 }
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1133 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
1134
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1135 tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1136 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->fgcolor),
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1137 (tmp != NULL), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1138 if (tmp != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1139 gchar *markup = g_strdup_printf("<span foreground=\"%s\">%s</span>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1140 tmp, gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1141 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1142 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1143 }
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1144 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
1145
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1146 tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1147 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bgcolor),
32896
a9cbf3a55393 Having a backcolor and a background seems a bit redundant. And we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32895
diff changeset
1148 (tmp != 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
1149 if (tmp != NULL) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1150 gchar *markup = g_strdup_printf("<span background=\"%s\">%s</span>",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1151 tmp, gtk_label_get_label(label));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1152 gtk_label_set_markup_with_mnemonic(label, markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1153 g_free(markup);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1154 }
32895
fbd3b11e535a WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32820
diff changeset
1155 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
1156 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1157
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1158 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1159 toggle_button_cb(GtkWebView *webview, GtkWebViewButtons buttons,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1160 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1161 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1162 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
1163 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1164
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1165 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1166 update_format_cb(GtkWebView *webview, GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1167 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1168 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
1169 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1170
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1171 #if 0
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1172 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1173 mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, GtkTextMark *mark,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1174 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1175 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1176 if(mark != gtk_text_buffer_get_insert(buffer))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1177 return;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1178
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1179 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
1180 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1181 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1182
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1183 /* 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
1184 * 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
1185 * 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
1186 */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1187 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1188 menu_position_func(GtkMenu *menu,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1189 int *x,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1190 int *y,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1191 gboolean *push_in,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1192 gpointer data)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1193 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1194 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
1195 GtkRequisition menu_req;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1196 gint ythickness = widget->style->ythickness;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1197 int savy;
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 gtk_widget_size_request(GTK_WIDGET (menu), &menu_req);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1200 gdk_window_get_origin(widget->window, x, y);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1201 *x += widget->allocation.x;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1202 *y += widget->allocation.y + widget->allocation.height;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1203 savy = *y;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1204
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1205 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
1206
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1207 if (savy > *y + ythickness + 1)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1208 *y -= widget->allocation.height;
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1211 static gboolean
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1212 button_activate_on_click(GtkWidget *button, GdkEventButton *event,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1213 GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1214 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1215 if (event->button == 1 && GTK_IS_TOGGLE_BUTTON(button))
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1216 gtk_widget_activate(button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1217 else if (event->button == 3)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1218 return gtk_webviewtoolbar_popup_menu(button, event, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1219 return FALSE;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1220 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1221
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1222 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1223 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
1224 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1225 gtk_widget_show_all(GTK_WIDGET(menu));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1226 gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time());
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1227 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1228
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1229 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1230 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
1231 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1232 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1233 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1234
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1235 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1236 switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1237 {
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1238 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
1239 !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
1240 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1241
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1242 static gboolean
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1243 gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event,
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1244 GtkWebViewToolbar *toolbar)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1245 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1246 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1247 GtkWidget *menu;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1248 GtkWidget *item;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1249 gboolean wide;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1250
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1251 if (event->button != 3)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1252 return FALSE;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1253
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1254 wide = gtk_widget_get_visible(priv->bold);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1255
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1256 menu = gtk_menu_new();
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1257 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
1258 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
1259 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
1260 gtk_widget_show(item);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1261
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1262 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper,
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1263 widget, event->button, event->time);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1264 return TRUE;
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1265 }
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 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1268 button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1269 {
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1270 if (gtk_widget_get_visible(button))
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1271 gtk_widget_hide(item);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1272 else
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1273 gtk_widget_show(item);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1274 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1275
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1276 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1277 button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1278 {
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1279 gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button));
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1280 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1281
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1282 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1283 update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item)
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 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1286 gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button));
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1287 g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button);
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1288 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1289
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1290 static void
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1291 enable_markup(GtkWidget *widget, gpointer null)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1292 {
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1293 if (GTK_IS_LABEL(widget))
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1294 g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL);
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 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
1299 gconstpointer value, gpointer toolbar)
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1300 {
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
1301 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1302 if (value) {
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
1303 gtk_widget_hide_all(priv->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
1304 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
1305 } else {
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
1306 gtk_widget_hide_all(priv->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
1307 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
1308 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1309 }
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1310
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1311 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1312 * GObject stuff
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1313 *****************************************************************************/
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1314
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1315 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1316 gtk_webviewtoolbar_finalize(GObject *object)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1317 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1318 GtkWebViewToolbar *toolbar = GTK_WEBVIEWTOOLBAR(object);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1319 GtkWebViewToolbarPriv *priv = GTK_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
1320
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1321 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
1322 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1323 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
1324 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
1325 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1326
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1327 destroy_toolbar_font(NULL, NULL, toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1328 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
1329 #if 0
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1330 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
1331 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
1332 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1333 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1334 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
1335 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
1336 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
1337 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
1338 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
1339 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
1340 toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1341 #if 0
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1342 g_signal_handlers_disconnect_matched(GTK_WEBVIEW(toolbar->webview)->text_buffer,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1343 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
1344 toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1345 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1346 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1347
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1348 g_free(priv->sml);
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1349
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1350 #if !GTK_CHECK_VERSION(2,12,0)
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1351 gtk_object_sink(GTK_OBJECT(priv->tooltips));
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1352 #endif
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1353
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
1354 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
1355 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
1356 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
1357 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
1358
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1359 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
1360
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1361 G_OBJECT_CLASS(parent_class)->finalize (object);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1362 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1363
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1364 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1365 gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1366 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1367 GObjectClass *gobject_class;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1368 gobject_class = (GObjectClass *)class;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1369 parent_class = g_type_class_ref(GTK_TYPE_HBOX);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1370 gobject_class->finalize = gtk_webviewtoolbar_finalize;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1371
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1372 g_type_class_add_private(class, sizeof(GtkWebViewToolbarPriv));
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1373
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1374 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
1375 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
1376 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1377
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1378 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1379 gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1380 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1381 GtkWebViewToolbarPriv *priv = GTK_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
1382 GtkWidget *hbox;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1383 GtkWidget *button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1384 struct {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1385 char *stock;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1386 gpointer callback;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1387 GtkWidget **button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1388 const char *tooltip;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1389 } buttons[] = {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1390 {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &priv->bold, _("Bold")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1391 {GTK_STOCK_ITALIC, do_italic, &priv->italic, _("Italic")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1392 {GTK_STOCK_UNDERLINE, do_underline, &priv->underline, _("Underline")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1393 {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &priv->strike, _("Strikethrough")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1394 {"", NULL, NULL, NULL},
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1395 {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &priv->larger_size, _("Increase Font Size")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1396 {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &priv->smaller_size, _("Decrease Font Size")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1397 {"", NULL, NULL, NULL},
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1398 {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &priv->font, _("Font Face")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1399 {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &priv->fgcolor, _("Foreground Color")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1400 {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &priv->bgcolor, _("Background Color")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1401 {"", NULL, NULL, NULL},
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1402 {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &priv->clear, _("Reset Formatting")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1403 {"", NULL, NULL, NULL},
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1404 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &priv->image, _("Insert IM Image")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1405 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &priv->link, _("Insert Link")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1406 {"", NULL, NULL, NULL},
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1407 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &priv->smiley, _("Insert Smiley")},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1408 {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &priv->attention, _("Send Attention")},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1409 {NULL, NULL, NULL, NULL}
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1410 };
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1411 int iter;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1412
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1413 hbox = gtk_hbox_new(FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1414
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1415 for (iter = 0; buttons[iter].stock; iter++) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1416 if (buttons[iter].stock[0]) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1417 button = pidgin_pixbuf_toolbar_button_from_stock(buttons[iter].stock);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1418 g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1419 g_signal_connect(G_OBJECT(button), "clicked",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1420 G_CALLBACK(buttons[iter].callback), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1421 *(buttons[iter].button) = button;
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1422 gtk_widget_set_tooltip_text(button, buttons[iter].tooltip);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1423 } else
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1424 button = gtk_vseparator_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1425 gtk_box_pack_start(GTK_BOX(hbox), 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
1426 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1427
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1428 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0);
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
1429 priv->wide_view = hbox;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1430 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1431
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1432 static void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1433 gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1434 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1435 GtkWebViewToolbarPriv *priv = GTK_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
1436 GtkWidget *hbox = GTK_WIDGET(toolbar), *event = gtk_event_box_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1437 GtkWidget *bbox, *box = gtk_hbox_new(FALSE, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1438 GtkWidget *image;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1439 GtkWidget *label;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1440 GtkWidget *insert_button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1441 GtkWidget *font_button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1442 GtkWidget *smiley_button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1443 GtkWidget *attention_button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1444 GtkWidget *font_menu;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1445 GtkWidget *insert_menu;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1446 GtkWidget *menuitem;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1447 GtkWidget *sep;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1448 int i;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1449 struct {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1450 const char *label;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1451 GtkWidget **button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1452 gboolean check;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1453 } buttons[] = {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1454 {_("<b>_Bold</b>"), &priv->bold, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1455 {_("<i>_Italic</i>"), &priv->italic, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1456 {_("<u>_Underline</u>"), &priv->underline, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1457 {_("<span strikethrough='true'>Strikethrough</span>"), &priv->strike, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1458 {_("<span size='larger'>_Larger</span>"), &priv->larger_size, TRUE},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1459 #if 0
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1460 {_("_Normal"), &priv->normal_size, TRUE},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1461 #endif
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1462 {_("<span size='smaller'>_Smaller</span>"), &priv->smaller_size, TRUE},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1463 /* If we want to show the formatting for the following items, we would
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1464 * need to update them when formatting changes. The above items don't need
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1465 * no updating nor nothin' */
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1466 {_("_Font face"), &priv->font, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1467 {_("Foreground _color"), &priv->fgcolor, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1468 {_("Bac_kground color"), &priv->bgcolor, TRUE},
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1469 {_("_Reset formatting"), &priv->clear, FALSE},
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1470 {NULL, NULL, FALSE}
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1471 };
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1472
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1473 toolbar->webview = NULL;
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1474 priv->font_dialog = NULL;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1475 priv->fgcolor_dialog = NULL;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1476 priv->bgcolor_dialog = NULL;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1477 priv->link_dialog = NULL;
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1478 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
1479 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
1480
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1481 #if !GTK_CHECK_VERSION(2,12,0)
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1482 priv->tooltips = gtk_tooltips_new();
32820
d8ad578dad76 Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32819
diff changeset
1483 #endif
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1484
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1485 gtk_box_set_spacing(GTK_BOX(toolbar), 3);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1486
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1487 gtk_webviewtoolbar_create_old_buttons(toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1488
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1489 /* Fonts */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1490 font_button = gtk_toggle_button_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1491 gtk_button_set_relief(GTK_BUTTON(font_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
1492 bbox = gtk_hbox_new(FALSE, 3);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1493 gtk_container_add(GTK_CONTAINER(font_button), bbox);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1494 image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1495 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0);
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
1496 priv->font_label = label = gtk_label_new_with_mnemonic(_("_Font"));
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1497 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1498 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1499 gtk_box_pack_start(GTK_BOX(box), font_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
1500 gtk_widget_show_all(font_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1501
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
1502 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
1503
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1504 for (i = 0; buttons[i].label; i++) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1505 GtkWidget *old = *buttons[i].button;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1506 if (buttons[i].check) {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1507 menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1508 g_signal_connect_after(G_OBJECT(old), "toggled",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1509 G_CALLBACK(update_menuitem), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1510 } else {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1511 menuitem = gtk_menu_item_new_with_mnemonic(buttons[i].label);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1512 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1513 g_signal_connect_swapped(G_OBJECT(menuitem), "activate",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1514 G_CALLBACK(gtk_button_clicked), old);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1515 gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1516 g_signal_connect(G_OBJECT(old), "notify::sensitive",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1517 G_CALLBACK(button_sensitiveness_changed), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1518 g_signal_connect(G_OBJECT(old), "notify::visible",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1519 G_CALLBACK(button_visibility_changed), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1520 gtk_container_foreach(GTK_CONTAINER(menuitem), (GtkCallback)enable_markup, NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1521 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1522
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1523 g_signal_connect(G_OBJECT(font_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1524 g_signal_connect(G_OBJECT(font_button), "activate", G_CALLBACK(pidgin_menu_clicked), font_menu);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1525 g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1526
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1527 /* Sep */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1528 sep = gtk_vseparator_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1529 gtk_box_pack_start(GTK_BOX(box), sep, 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
1530 gtk_widget_show_all(sep);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1531
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1532 /* Insert */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1533 insert_button = gtk_toggle_button_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1534 gtk_button_set_relief(GTK_BUTTON(insert_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
1535 bbox = gtk_hbox_new(FALSE, 3);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1536 gtk_container_add(GTK_CONTAINER(insert_button), bbox);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1537 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1538 gtk_box_pack_start(GTK_BOX(bbox), image, 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
1539 label = gtk_label_new_with_mnemonic(_("_Insert"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1540 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1541 gtk_box_pack_start(GTK_BOX(box), insert_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
1542 gtk_widget_show_all(insert_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1543
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
1544 priv->insert_menu = insert_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
1545
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1546 menuitem = gtk_menu_item_new_with_mnemonic(_("_Image"));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1547 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), 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
1548 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1549 g_signal_connect(G_OBJECT(priv->image), "notify::sensitive",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1550 G_CALLBACK(button_sensitiveness_changed), menuitem);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1551 g_signal_connect(G_OBJECT(priv->image), "notify::visible",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1552 G_CALLBACK(button_visibility_changed), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1553
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1554 menuitem = gtk_menu_item_new_with_mnemonic(_("_Link"));
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1555 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), 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
1556 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1557 g_signal_connect(G_OBJECT(priv->link), "notify::sensitive",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1558 G_CALLBACK(button_sensitiveness_changed), menuitem);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1559 g_signal_connect(G_OBJECT(priv->link), "notify::visible",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1560 G_CALLBACK(button_visibility_changed), menuitem);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1561
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1562 menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1563 g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1564 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1565 priv->insert_hr = menuitem;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1566
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1567 g_signal_connect(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1568 g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1569 g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1570 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
1571
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1572 /* Sep */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1573 sep = gtk_vseparator_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1574 gtk_box_pack_start(GTK_BOX(box), sep, 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
1575 gtk_widget_show_all(sep);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1576
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1577 /* Smiley */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1578 smiley_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
1579 gtk_button_set_relief(GTK_BUTTON(smiley_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
1580 bbox = gtk_hbox_new(FALSE, 3);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1581 gtk_container_add(GTK_CONTAINER(smiley_button), bbox);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1582 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1583 gtk_box_pack_start(GTK_BOX(bbox), image, 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
1584 label = gtk_label_new_with_mnemonic(_("_Smile!"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1585 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1586 gtk_box_pack_start(GTK_BOX(box), smiley_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
1587 g_signal_connect(G_OBJECT(smiley_button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1588 g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), priv->smiley);
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1589 gtk_widget_show_all(smiley_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1590
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1591 /* Sep */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1592 sep = gtk_vseparator_new();
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1593 gtk_box_pack_start(GTK_BOX(box), sep, 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
1594 gtk_widget_show_all(sep);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1595
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1596 /* Attention */
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1597 attention_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
1598 gtk_button_set_relief(GTK_BUTTON(attention_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
1599 bbox = gtk_hbox_new(FALSE, 3);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1600 gtk_container_add(GTK_CONTAINER(attention_button), bbox);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1601 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1602 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1603 gtk_box_pack_start(GTK_BOX(bbox), image, 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
1604 label = gtk_label_new_with_mnemonic(_("_Attention!"));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1605 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1606 gtk_box_pack_start(GTK_BOX(box), attention_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
1607 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked",
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1608 G_CALLBACK(gtk_button_clicked), 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
1609 gtk_widget_show_all(attention_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1610
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1611 g_signal_connect(G_OBJECT(priv->attention), "notify::sensitive",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1612 G_CALLBACK(button_sensitiveness_changed), attention_button);
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1613 g_signal_connect(G_OBJECT(priv->attention), "notify::visible",
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1614 G_CALLBACK(button_visibility_changed), attention_button);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1615
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1616 /* set attention button to be greyed out until we get a conversation */
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1617 gtk_widget_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
1618
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1619 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0);
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
1620 priv->lean_view = box;
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1621 gtk_widget_show(box);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1622
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1623 purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1624 webviewtoolbar_view_pref_changed, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1625 g_signal_connect_data(G_OBJECT(toolbar), "realize",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1626 G_CALLBACK(purple_prefs_trigger_callback), PIDGIN_PREFS_ROOT "/conversations/toolbar/wide",
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1627 NULL, G_CONNECT_AFTER | 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
1628
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1629 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1630
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1631 gtk_widget_add_events(event, 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
1632 gtk_box_pack_start(GTK_BOX(hbox), event, 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
1633 g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1634 gtk_widget_show(event);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1635 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1636
32815
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1637 /******************************************************************************
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1638 * Public API
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1639 *****************************************************************************/
0ddffe446ee1 Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32814
diff changeset
1640
32806
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1641 GtkWidget *
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1642 gtk_webviewtoolbar_new(void)
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 return GTK_WIDGET(g_object_new(gtk_webviewtoolbar_get_type(), NULL));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1645 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1646
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1647 GType
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1648 gtk_webviewtoolbar_get_type(void)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1649 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1650 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
1651
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1652 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
1653 static const GTypeInfo webviewtoolbar_info = {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1654 sizeof(GtkWebViewToolbarClass),
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 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1657 (GClassInitFunc)gtk_webviewtoolbar_class_init,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1658 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1659 NULL,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1660 sizeof(GtkWebViewToolbar),
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1661 0,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1662 (GInstanceInitFunc)gtk_webviewtoolbar_init,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1663 NULL
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1666 webviewtoolbar_type = g_type_register_static(GTK_TYPE_HBOX,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1667 "GtkWebViewToolbar", &webviewtoolbar_info, 0);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1668 }
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 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
1671 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1672
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1673 void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1674 gtk_webviewtoolbar_attach(GtkWebViewToolbar *toolbar, GtkWidget *webview)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1675 {
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1676 GtkWebViewButtons buttons;
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1677
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1678 g_return_if_fail(toolbar != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1679 g_return_if_fail(GTK_IS_WEBVIEWTOOLBAR(toolbar));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1680 g_return_if_fail(webview != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1681 g_return_if_fail(GTK_IS_WEBVIEW(webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1682
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1683 toolbar->webview = webview;
32814
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1684 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
1685 G_CALLBACK(update_buttons_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1686 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
1687 G_CALLBACK(toggle_button_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1688 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
1689 G_CALLBACK(update_format_cb), toolbar);
6c18bb651f3d Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32806
diff changeset
1690 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
1691 G_CALLBACK(update_format_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
1692 #if 0
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1693 g_signal_connect_after(G_OBJECT(GTK_WEBVIEW(webview)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1694 #endif
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1695
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1696 buttons = gtk_webview_get_format_functions(GTK_WEBVIEW(webview));
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1697 update_buttons_cb(GTK_WEBVIEW(webview), buttons, toolbar);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1698 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
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
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1702 gtk_webviewtoolbar_associate_smileys(GtkWebViewToolbar *toolbar,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1703 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
1704 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1705 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1706 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
1707 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
1708 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1709
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1710 void
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1711 gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar,
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1712 PurpleConversation *conv)
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1713 {
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1714 GtkWebViewToolbarPriv *priv = GTK_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
1715 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
1716 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
1717
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
1718 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
1719
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1720 /* 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
1721 for the time being it is always disabled for chats */
32817
016056e052ef Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32815
diff changeset
1722 gtk_widget_set_sensitive(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
1723 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1724 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL);
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1725 }
b7a37f648129 Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1726

mercurial