Tue, 28 Feb 2012 04:25:49 +0000
propagate from branch 'im.pidgin.pidgin' (head 1edfa83f6ff820fb7904d5bab5b0943f691976f6)
to branch 'im.pidgin.cpw.qulogic.gtk3-required' (head c73cb391930b3e14ef63dedb389f5bfe01077508)
|
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 | |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
207 | sel = GTK_FONT_SELECTION( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
208 | gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(priv->font_dialog))); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
209 | gtk_widget_hide(gtk_widget_get_parent( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
210 | gtk_font_selection_get_size_entry(sel))); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
211 | gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
212 | gtk_widget_show(gtk_widget_get_parent( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
213 | gtk_font_selection_get_family_list(sel))); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
214 | gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
215 | gtk_font_selection_get_family_list(sel)))); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
216 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
217 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
218 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
219 | 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
|
220 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
221 | 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
|
222 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
223 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
224 | 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
|
225 | 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
|
226 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
227 | /* 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
|
228 | 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
|
229 | 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
|
230 | 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
|
231 | 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
|
232 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
233 | if (fontname) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
234 | 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
|
235 | 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
|
236 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
237 | 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
|
238 | 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
|
239 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
240 | 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
|
241 | 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
|
242 | family_name); |
|
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 | 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
|
246 | 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
|
247 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
248 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
249 | 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
|
250 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
251 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
252 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
253 | 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
|
254 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
255 | 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
|
256 | 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
|
257 | 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
|
258 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
259 | 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
|
260 | 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
|
261 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
262 | 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
|
263 | 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
|
264 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
265 | if (fontname) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
266 | 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
|
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 | fonttif); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
269 | 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
|
270 | } else { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
271 | 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
|
272 | 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
|
273 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
274 | |
|
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(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
|
276 | G_CALLBACK(destroy_toolbar_font), toolbar); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
277 | g_signal_connect(G_OBJECT( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
278 | gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(priv->font_dialog))), |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
279 | "clicked", G_CALLBACK(apply_font), toolbar); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
280 | g_signal_connect(G_OBJECT( |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
281 | gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(priv->font_dialog))), |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
282 | "clicked", 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
|
283 | 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
|
284 | 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
|
285 | } |
|
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
|
286 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
287 | 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
|
288 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
289 | 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
|
290 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
291 | 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
|
292 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
293 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
294 | 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
|
295 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
296 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
297 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
298 | 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
|
299 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
300 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
301 | 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
|
302 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
303 | 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
|
304 | 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
|
305 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
306 | 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
|
307 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
308 | 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
|
309 | 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
|
310 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
311 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
312 | return FALSE; |
|
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 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
316 | 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
|
317 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
318 | 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
|
319 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
320 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
321 | 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
|
322 | 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
|
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 | 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
|
325 | 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
|
326 | 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
|
327 | 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
|
328 | 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
|
329 | |
|
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
|
330 | dialog = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
331 | colorsel = GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)); |
|
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
|
332 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
333 | 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
|
334 | 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
|
335 | 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
|
336 | 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
|
337 | 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
|
338 | 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
|
339 | 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
|
340 | 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
|
341 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
342 | 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
|
343 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
344 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
345 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
346 | 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
|
347 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
348 | 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
|
349 | 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
|
350 | GtkWidget *colorsel; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
351 | 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
|
352 | 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
|
353 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
354 | if (!priv->fgcolor_dialog) { |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
355 | GtkWidget *ok_button; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
356 | GtkWidget *cancel_button; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
357 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
358 | priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
359 | colorsel = |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
360 | gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
361 | if (color) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
362 | 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
|
363 | 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
|
364 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
365 | |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
366 | g_object_get(G_OBJECT(priv->fgcolor_dialog), "ok-button", &ok_button, NULL); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
367 | g_object_get(G_OBJECT(priv->fgcolor_dialog), "cancel-button", &cancel_button, NULL); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
368 | 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
|
369 | G_CALLBACK(destroy_toolbar_fgcolor), toolbar); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
370 | g_signal_connect(G_OBJECT(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
|
371 | G_CALLBACK(do_fgcolor), toolbar); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
372 | g_signal_connect(G_OBJECT(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
|
373 | 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
|
374 | } |
|
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
|
375 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
376 | 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
|
377 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
378 | 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
|
379 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
380 | 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
|
381 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
382 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
383 | 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
|
384 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
385 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
386 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
387 | 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
|
388 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
389 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
390 | 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
|
391 | 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
|
392 | 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
|
393 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
394 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
395 | 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
|
396 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
397 | 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
|
398 | 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
|
399 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
400 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
401 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
402 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
403 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
404 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
405 | 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
|
406 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
407 | 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
|
408 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
409 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
410 | 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
|
411 | 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
|
412 | { |
|
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
|
413 | 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
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | 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
|
418 | |
|
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
|
419 | dialog = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
420 | colorsel = GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)); |
|
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
|
421 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
422 | 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
|
423 | 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
|
424 | 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
|
425 | 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
|
426 | 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
|
427 | 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
|
428 | 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
|
429 | 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
|
430 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
431 | 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
|
432 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
433 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
434 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
435 | 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
|
436 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
437 | 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
|
438 | 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
|
439 | GtkWidget *colorsel; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
440 | 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
|
441 | 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
|
442 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
443 | if (!priv->bgcolor_dialog) { |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
444 | GtkWidget *ok_button; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
445 | GtkWidget *cancel_button; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
446 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
447 | priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
448 | colorsel = |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
449 | gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
450 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
451 | if (color) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
452 | 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
|
453 | 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
|
454 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
455 | |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
456 | g_object_get(G_OBJECT(priv->bgcolor_dialog), "ok-button", &ok_button, NULL); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
457 | g_object_get(G_OBJECT(priv->bgcolor_dialog), "cancel-button", |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
458 | &cancel_button, NULL); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
459 | 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
|
460 | G_CALLBACK(destroy_toolbar_bgcolor), toolbar); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
461 | g_signal_connect(G_OBJECT(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
|
462 | G_CALLBACK(do_bgcolor), toolbar); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
463 | g_signal_connect(G_OBJECT(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
|
464 | 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
|
465 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
466 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
467 | 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
|
468 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
469 | 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
|
470 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
471 | 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
|
472 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
473 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
474 | 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
|
475 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
476 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
477 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
478 | 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
|
479 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
480 | 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
|
481 | 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
|
482 | 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
|
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 | 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
|
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); |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
489 | 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
|
490 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
491 | 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
|
492 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
493 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
494 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
495 | 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
|
496 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
497 | 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
|
498 | 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
|
499 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
500 | 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
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
505 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
506 | 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
|
507 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
508 | 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
|
509 | 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
|
510 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
511 | 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
|
512 | 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
|
513 | 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
|
514 | else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
515 | description = NULL; |
|
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 | if (description == NULL) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
518 | description = url; |
|
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 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
521 | gtk_webview_insert_link(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
|
522 | gtk_text_buffer_get_insert(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
|
523 | url, description); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
524 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
525 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
526 | 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
|
527 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
528 | priv->link_dialog = NULL; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
529 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
530 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
531 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
532 | 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
|
533 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
534 | 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
|
535 | 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
|
536 | PurpleRequestFields *fields; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
537 | PurpleRequestFieldGroup *group; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
538 | PurpleRequestField *field; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
539 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
540 | GtkTextIter start, end; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
541 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
542 | char *msg; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
543 | 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
|
544 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
545 | 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
|
546 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
547 | 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
|
548 | 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
|
549 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
550 | 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
|
551 | 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
|
552 | 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
|
553 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
554 | 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
|
555 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
556 | if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, &start, &end)) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
557 | desc = gtk_webview_get_text(GTK_WEBVIEW(toolbar->webview), &start, &end); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
558 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
559 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
560 | 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
|
561 | desc, FALSE); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
562 | 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
|
563 | 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
|
564 | "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
|
565 | "is optional.")); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
566 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
567 | 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
|
568 | "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
|
569 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
570 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
571 | 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
|
572 | 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
|
573 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
574 | msg, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
575 | fields, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
576 | _("_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
|
577 | _("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
|
578 | 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
|
579 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
580 | 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
|
581 | 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
|
582 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
583 | 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
|
584 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
585 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
586 | 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
|
587 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
588 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
589 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
590 | 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
|
591 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
592 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
593 | GtkTextIter iter; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
594 | GtkTextMark *ins; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
595 | GtkIMHtmlScalable *hr; |
|
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 | 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
|
598 | gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), &iter, ins); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
599 | hr = gtk_webview_hr_new(); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
600 | gtk_webview_hr_add_to(hr, GTK_WEBVIEW(toolbar->webview), &iter); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
601 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
602 | } |
|
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 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
605 | 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
|
606 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
607 | 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
|
608 | 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
|
609 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
610 | 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
|
611 | char *filedata; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
612 | 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
|
613 | 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
|
614 | int id; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
615 | GtkTextIter iter; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
616 | GtkTextMark *ins; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
617 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
618 | 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
|
619 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
620 | 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
|
621 | return; |
|
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 | 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
|
625 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
626 | 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
|
627 | 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
|
628 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
629 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
630 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
631 | /* 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
|
632 | 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
|
633 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
634 | 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
|
635 | 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
|
636 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
637 | 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
|
638 | 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
|
639 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
640 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
641 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
642 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
643 | 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
|
644 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
645 | 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
|
646 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
647 | 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
|
648 | 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
|
649 | 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
|
650 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
651 | 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
|
652 | 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
|
653 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
654 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
655 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
656 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
657 | 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
|
658 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
659 | 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
|
660 | 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
|
661 | &iter, ins); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
662 | 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
|
663 | 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
|
664 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
665 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
666 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
667 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
668 | 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
|
669 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
670 | 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
|
671 | GtkWidget *window; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
672 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
673 | 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
|
674 | 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
|
675 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
676 | 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
|
677 | 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
|
678 | 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
|
679 | NULL); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
680 | 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
|
681 | 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
|
682 | "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
|
683 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
684 | 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
|
685 | 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
|
686 | } else { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
687 | gtk_widget_destroy(priv->image_dialog); |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
688 | 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
|
689 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
690 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
691 | 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
|
692 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
693 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
694 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
695 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
696 | 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
|
697 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
698 | 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
|
699 | 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
|
700 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
701 | 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
|
702 | 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
|
703 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
704 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
705 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
706 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
707 | 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
|
708 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
709 | 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
|
710 | 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
|
711 | return FALSE; |
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
714 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
715 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
716 | 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
|
717 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
718 | 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
|
719 | 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
|
720 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
721 | 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
|
722 | 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
|
723 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
724 | 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
|
725 | 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
|
726 | escaped_smiley); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
727 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
728 | 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
|
729 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
730 | 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
|
731 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
732 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
733 | /* 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
|
734 | 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
|
735 | 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
|
736 | GtkWidget *button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
737 | 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
|
738 | 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
|
739 | }; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
740 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
741 | 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
|
742 | 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
|
743 | 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
|
744 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
745 | 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
|
746 | GtkWidget *image; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
747 | GtkWidget *button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
748 | GtkRequisition size; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
749 | 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
|
750 | 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
|
751 | 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
|
752 | 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
|
753 | 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
|
754 | 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
|
755 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
756 | 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
|
757 | it = ls; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
758 | 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
|
759 | 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
|
760 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
761 | 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
|
762 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
763 | 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
|
764 | 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
|
765 | 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
|
766 | GtkImageType type; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
767 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
768 | 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
|
769 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
770 | 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
|
771 | 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
|
772 | } 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
|
773 | GdkPixbufAnimation *animation; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
774 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
775 | 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
|
776 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
777 | 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
|
778 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
779 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
780 | 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
|
781 | GdkPixbuf *resized; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
782 | 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
|
783 | 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
|
784 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
785 | 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
|
786 | 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
|
787 | 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
|
788 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
789 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
790 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
791 | (*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
|
792 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
793 | 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
|
794 | 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
|
795 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
796 | 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
|
797 | 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
|
798 | |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
799 | 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
|
800 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
801 | /* 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
|
802 | 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
|
803 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
804 | 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
|
805 | /* 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
|
806 | "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
|
807 | 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
|
808 | 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
|
809 | 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
|
810 | 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
|
811 | _("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
|
812 | face); |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
813 | 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
|
814 | 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
|
815 | } 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
|
816 | /* 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
|
817 | 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
|
818 | 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
|
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 | /* 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
|
822 | 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
|
823 | 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
|
824 | 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
|
825 | 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
|
826 | 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
|
827 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
828 | /* 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
|
829 | 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
|
830 | return cur; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
831 | 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
|
832 | 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
|
833 | 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
|
834 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
835 | 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
|
836 | 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
|
837 | return ls; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
838 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
839 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
840 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
841 | 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
|
842 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
843 | 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
|
844 | while (list) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
845 | 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
|
846 | 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
|
847 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
848 | 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
|
849 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
850 | return TRUE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
851 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
852 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
853 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
854 | 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
|
855 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
856 | { |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
857 | if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
858 | (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
|
859 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
860 | 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
|
861 | return TRUE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
862 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
863 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
864 | return FALSE; |
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
867 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
868 | 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
|
869 | 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
|
870 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
871 | GtkWidget *line; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
872 | 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
|
873 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
874 | if (!list) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
875 | return; |
|
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 | 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
|
878 | 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
|
879 | 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
|
880 | 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
|
881 | continue; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
882 | 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
|
883 | 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
|
884 | 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
|
885 | 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
|
886 | 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
|
887 | 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
|
888 | 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
|
889 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
890 | 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
|
891 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
892 | } |
|
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 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
895 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
896 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
897 | 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
|
898 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
899 | #if 0 |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
900 | 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
|
901 | 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
|
902 | 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
|
903 | 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
|
904 | 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
|
905 | 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
|
906 | GtkRequisition req; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
907 | 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
|
908 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
909 | 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
|
910 | 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
|
911 | 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
|
912 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
913 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
914 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
915 | if (priv->sml) |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
916 | 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
|
917 | else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
918 | 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
|
919 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
920 | /* 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
|
921 | 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
|
922 | work... */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
923 | while(smileys) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
924 | 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
|
925 | 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
|
926 | 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
|
927 | 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
|
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 | 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
|
931 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
932 | 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
|
933 | 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
|
934 | 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
|
935 | 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
|
936 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
937 | 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
|
938 | 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
|
939 | 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
|
940 | 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
|
941 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
942 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
943 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
944 | /* 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
|
945 | 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
|
946 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
947 | 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
|
948 | 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
|
949 | 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
|
950 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
951 | 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
|
952 | 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
|
953 | 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
|
954 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
955 | /* 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
|
956 | ls = NULL; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
957 | 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
|
958 | 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
|
959 | 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
|
960 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
961 | 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
|
962 | 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
|
963 | GtkRequisition req; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
964 | 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
|
965 | 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
|
966 | 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
|
967 | 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
|
968 | 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
|
969 | 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
|
970 | 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
|
971 | } |
|
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 | /* 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
|
974 | 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
|
975 | 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
|
976 | 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
|
977 | 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
|
978 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
979 | 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
|
980 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
981 | /* 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
|
982 | 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
|
983 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
984 | /* 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
|
985 | 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
|
986 | 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
|
987 | 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
|
988 | 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
|
989 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
990 | while (ls) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
991 | 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
|
992 | 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
|
993 | ls = tmp; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
994 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
995 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
996 | 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
|
997 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
998 | else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
999 | 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
|
1000 | 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
|
1001 | 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
|
1002 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1003 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1004 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1005 | 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
|
1006 | 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
|
1007 | 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
|
1008 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1009 | 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
|
1010 | 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
|
1011 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1012 | /* connect signals */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1013 | 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
|
1014 | 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
|
1015 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1016 | 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
|
1017 | 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
|
1018 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1019 | /* show everything */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1020 | 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
|
1021 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1022 | 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
|
1023 | 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
|
1024 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1025 | /* 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
|
1026 | * 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
|
1027 | * 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
|
1028 | * 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
|
1029 | * 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
|
1030 | 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
|
1031 | 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
|
1032 | "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
|
1033 | "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
|
1034 | NULL); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1035 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1036 | #ifdef _WIN32 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1037 | 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
|
1038 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1039 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1040 | 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
|
1041 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1042 | 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
|
1043 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1044 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1045 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1046 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1047 | 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
|
1048 | { |
|
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
|
1049 | 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
|
1050 | 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
|
1051 | 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
|
1052 | 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
|
1053 | |
|
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(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
|
1055 | 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
|
1056 | 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
|
1057 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1058 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1059 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1060 | 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
|
1061 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1062 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1063 | 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
|
1064 | 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
|
1065 | 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
|
1066 | 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
|
1067 | 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
|
1068 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1069 | 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
|
1070 | 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
|
1071 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1072 | 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
|
1073 | 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
|
1074 | 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
|
1075 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1076 | 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
|
1077 | (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
|
1078 | 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
|
1079 | 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
|
1080 | 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
|
1081 | 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
|
1082 | 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
|
1083 | 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
|
1084 | 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
|
1085 | 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
|
1086 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1087 | 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
|
1088 | 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
|
1089 | 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
|
1090 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1091 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1092 | /* 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
|
1093 | * 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
|
1094 | * 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
|
1095 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1096 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1097 | 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
|
1098 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1099 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1100 | GObject *object; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1101 | 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
|
1102 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1103 | 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
|
1104 | 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
|
1105 | 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
|
1106 | 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
|
1107 | 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
|
1108 | 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
|
1109 | 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
|
1110 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1111 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1112 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1113 | 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
|
1114 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1115 | 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
|
1116 | 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
|
1117 | 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
|
1118 | 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
|
1119 | |
|
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_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
|
1121 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1122 | 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
|
1123 | &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
|
1124 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1125 | 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
|
1126 | 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
|
1127 | toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1128 | 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
|
1129 | 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
|
1130 | toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1131 | 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
|
1132 | 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
|
1133 | underline, toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1134 | 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
|
1135 | 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
|
1136 | strike, toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1137 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1138 | /* 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
|
1139 | 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
|
1140 | 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
|
1141 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1142 | if (bold) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1143 | 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
|
1144 | 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
|
1145 | 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
|
1146 | 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
|
1147 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1148 | if (italic) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1149 | 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
|
1150 | 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
|
1151 | 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
|
1152 | 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
|
1153 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1154 | if (underline) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1155 | 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
|
1156 | 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
|
1157 | 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
|
1158 | 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
|
1159 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1160 | if (strike) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1161 | 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
|
1162 | 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
|
1163 | 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
|
1164 | 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
|
1165 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1166 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1167 | 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
|
1168 | 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
|
1169 | (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
|
1170 | 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
|
1171 | 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
|
1172 | 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
|
1173 | 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
|
1174 | 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
|
1175 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1176 | 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
|
1177 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1178 | 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
|
1179 | 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
|
1180 | (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
|
1181 | 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
|
1182 | 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
|
1183 | 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
|
1184 | 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
|
1185 | 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
|
1186 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1187 | 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
|
1188 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1189 | 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
|
1190 | 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
|
1191 | (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
|
1192 | 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
|
1193 | 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
|
1194 | 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
|
1195 | 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
|
1196 | 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
|
1197 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1198 | 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
|
1199 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1200 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1201 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1202 | 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
|
1203 | GtkWebViewToolbar *toolbar) |
|
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 | 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
|
1206 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1207 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1208 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1209 | 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
|
1210 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1211 | 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
|
1212 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1213 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1214 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1215 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1216 | 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
|
1217 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1218 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1219 | 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
|
1220 | return; |
|
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 | 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
|
1223 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1224 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1225 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1226 | /* 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
|
1227 | * 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
|
1228 | * 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
|
1229 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1230 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1231 | 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
|
1232 | int *x, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1233 | int *y, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1234 | 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
|
1235 | gpointer data) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1236 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1237 | 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
|
1238 | GtkRequisition menu_req; |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1239 | GtkAllocation allocation; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1240 | gint ythickness = gtk_widget_get_style(widget)->ythickness; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1241 | int savy; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1242 | |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1243 | gtk_widget_get_allocation(widget, &allocation); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1244 | gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1245 | gdk_window_get_origin(gtk_widget_get_window(widget), x, y); |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1246 | *x += allocation.x; |
|
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1247 | *y += allocation.y + allocation.height; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1248 | savy = *y; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1249 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1250 | pidgin_menu_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
|
1251 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1252 | if (savy > *y + ythickness + 1) |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1253 | *y -= allocation.height; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1254 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1255 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1256 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1257 | 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
|
1258 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1259 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1260 | 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
|
1261 | 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
|
1262 | 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
|
1263 | 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
|
1264 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1265 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1266 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1267 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1268 | 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
|
1269 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1270 | 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
|
1271 | 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
|
1272 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1273 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1274 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1275 | 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
|
1276 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1277 | 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
|
1278 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1279 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1280 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1281 | switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1282 | { |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1283 | 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
|
1284 | !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
|
1285 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1286 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1287 | static gboolean |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1288 | 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
|
1289 | GtkWebViewToolbar *toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1290 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1291 | 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
|
1292 | GtkWidget *menu; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1293 | GtkWidget *item; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1294 | gboolean wide; |
|
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 | if (event->button != 3) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1297 | return FALSE; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1298 | |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1299 | 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
|
1300 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1301 | menu = gtk_menu_new(); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1302 | 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
|
1303 | 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
|
1304 | 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
|
1305 | gtk_widget_show(item); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1306 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1307 | 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
|
1308 | widget, event->button, event->time); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1309 | return TRUE; |
|
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 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1313 | 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
|
1314 | { |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1315 | if (gtk_widget_get_visible(button)) |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1316 | gtk_widget_hide(item); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1317 | else |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1318 | gtk_widget_show(item); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1319 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1320 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1321 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1322 | 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
|
1323 | { |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1324 | 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
|
1325 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1326 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1327 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1328 | update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1329 | { |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1330 | 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
|
1331 | 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
|
1332 | 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
|
1333 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1334 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1335 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1336 | enable_markup(GtkWidget *widget, gpointer null) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1337 | { |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1338 | if (GTK_IS_LABEL(widget)) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1339 | 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
|
1340 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1341 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1342 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1343 | 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
|
1344 | gconstpointer value, gpointer toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1345 | { |
|
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
|
1346 | 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
|
1347 | if (value) { |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1348 | gtk_widget_hide(priv->lean_view); |
|
32819
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
1349 | 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
|
1350 | } else { |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1351 | gtk_widget_hide(priv->wide_view); |
|
32819
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
1352 | 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
|
1353 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1354 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1355 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1356 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1357 | * GObject stuff |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1358 | *****************************************************************************/ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1359 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1360 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1361 | 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
|
1362 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1363 | 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
|
1364 | 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
|
1365 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1366 | 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
|
1367 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1368 | 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
|
1369 | 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
|
1370 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1371 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1372 | 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
|
1373 | 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
|
1374 | #if 0 |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1375 | 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
|
1376 | 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
|
1377 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1378 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1379 | 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
|
1380 | 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
|
1381 | 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
|
1382 | 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
|
1383 | 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
|
1384 | 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
|
1385 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1386 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1387 | 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
|
1388 | 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
|
1389 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1390 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1391 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1392 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1393 | g_free(priv->sml); |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1394 | |
|
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1395 | #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
|
1396 | 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
|
1397 | #endif |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1398 | |
|
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
|
1399 | 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
|
1400 | 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
|
1401 | 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
|
1402 | 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
|
1403 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1404 | 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
|
1405 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1406 | 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
|
1407 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1408 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1409 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1410 | 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
|
1411 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1412 | 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
|
1413 | 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
|
1414 | 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
|
1415 | 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
|
1416 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1417 | 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
|
1418 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1419 | 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
|
1420 | 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
|
1421 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1422 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1423 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1424 | 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
|
1425 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1426 | 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
|
1427 | GtkWidget *hbox; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1428 | GtkWidget *button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1429 | struct { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1430 | char *stock; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1431 | gpointer callback; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1432 | GtkWidget **button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1433 | 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
|
1434 | } buttons[] = { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1435 | {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
|
1436 | {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
|
1437 | {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
|
1438 | {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
|
1439 | {"", 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
|
1440 | {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
|
1441 | {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
|
1442 | {"", 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
|
1443 | {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
|
1444 | {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
|
1445 | {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
|
1446 | {"", 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
|
1447 | {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
|
1448 | {"", 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
|
1449 | {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
|
1450 | {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
|
1451 | {"", 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
|
1452 | {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
|
1453 | {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
|
1454 | {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
|
1455 | }; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1456 | int iter; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1457 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1458 | 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
|
1459 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1460 | 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
|
1461 | 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
|
1462 | 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
|
1463 | 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
|
1464 | 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
|
1465 | 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
|
1466 | *(buttons[iter].button) = button; |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1467 | 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
|
1468 | } else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1469 | 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
|
1470 | 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
|
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 | 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
|
1474 | 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
|
1475 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1476 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1477 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1478 | 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
|
1479 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1480 | 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
|
1481 | 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
|
1482 | 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
|
1483 | GtkWidget *image; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1484 | GtkWidget *label; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1485 | 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
|
1486 | 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
|
1487 | 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
|
1488 | 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
|
1489 | 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
|
1490 | 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
|
1491 | GtkWidget *menuitem; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1492 | GtkWidget *sep; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1493 | int i; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1494 | struct { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1495 | 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
|
1496 | GtkWidget **button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1497 | gboolean check; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1498 | } buttons[] = { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1499 | {_("<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
|
1500 | {_("<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
|
1501 | {_("<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
|
1502 | {_("<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
|
1503 | {_("<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
|
1504 | #if 0 |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1505 | {_("_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
|
1506 | #endif |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1507 | {_("<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
|
1508 | /* 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
|
1509 | * 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
|
1510 | * 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
|
1511 | {_("_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
|
1512 | {_("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
|
1513 | {_("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
|
1514 | {_("_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
|
1515 | {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
|
1516 | }; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1517 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1518 | 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
|
1519 | 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
|
1520 | 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
|
1521 | 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
|
1522 | 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
|
1523 | 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
|
1524 | 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
|
1525 | |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1526 | #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
|
1527 | priv->tooltips = gtk_tooltips_new(); |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1528 | #endif |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1529 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1530 | 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
|
1531 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1532 | 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
|
1533 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1534 | /* Fonts */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1535 | 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
|
1536 | 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
|
1537 | 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
|
1538 | 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
|
1539 | 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
|
1540 | 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
|
1541 | 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
|
1542 | 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
|
1543 | 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
|
1544 | 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
|
1545 | 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
|
1546 | |
|
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
|
1547 | 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
|
1548 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1549 | 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
|
1550 | 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
|
1551 | 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
|
1552 | 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
|
1553 | 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
|
1554 | 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
|
1555 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1556 | 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
|
1557 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1558 | 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
|
1559 | 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
|
1560 | 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
|
1561 | 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
|
1562 | 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
|
1563 | 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
|
1564 | 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
|
1565 | 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
|
1566 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1567 | |
|
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(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
|
1569 | 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
|
1570 | 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
|
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 | /* Insert */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1578 | 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
|
1579 | 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
|
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(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
|
1582 | 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
|
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(_("_Insert")); |
|
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), 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
|
1587 | 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
|
1588 | |
|
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
|
1589 | 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
|
1590 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1591 | 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
|
1592 | 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
|
1593 | 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
|
1594 | 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
|
1595 | 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
|
1596 | 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
|
1597 | 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
|
1598 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1599 | 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
|
1600 | 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
|
1601 | 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
|
1602 | 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
|
1603 | 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
|
1604 | 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
|
1605 | 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
|
1606 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1607 | 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
|
1608 | 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
|
1609 | 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
|
1610 | 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
|
1611 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1612 | 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
|
1613 | 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
|
1614 | 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
|
1615 | 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
|
1616 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1617 | /* Sep */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1618 | 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
|
1619 | 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
|
1620 | 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
|
1621 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1622 | /* Smiley */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1623 | 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
|
1624 | 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
|
1625 | 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
|
1626 | 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
|
1627 | 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
|
1628 | 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
|
1629 | 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
|
1630 | 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
|
1631 | 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
|
1632 | 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
|
1633 | 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
|
1634 | 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
|
1635 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1636 | /* Sep */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1637 | 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
|
1638 | 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
|
1639 | 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
|
1640 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1641 | /* Attention */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1642 | 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
|
1643 | 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
|
1644 | 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
|
1645 | 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
|
1646 | 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
|
1647 | 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
|
1648 | 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
|
1649 | 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
|
1650 | 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
|
1651 | 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
|
1652 | 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
|
1653 | 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
|
1654 | 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
|
1655 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1656 | 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
|
1657 | 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
|
1658 | 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
|
1659 | 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
|
1660 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1661 | /* 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
|
1662 | 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
|
1663 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1664 | 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
|
1665 | 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
|
1666 | 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
|
1667 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1668 | 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
|
1669 | 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
|
1670 | 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
|
1671 | 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
|
1672 | 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
|
1673 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1674 | 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
|
1675 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1676 | 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
|
1677 | 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
|
1678 | 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
|
1679 | 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
|
1680 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1681 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1682 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1683 | * Public API |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1684 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1685 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1686 | GtkWidget * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1687 | 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
|
1688 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1689 | 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
|
1690 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1691 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1692 | GType |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1693 | 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
|
1694 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1695 | 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
|
1696 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1697 | 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
|
1698 | 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
|
1699 | sizeof(GtkWebViewToolbarClass), |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1700 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1701 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1702 | (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
|
1703 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1704 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1705 | sizeof(GtkWebViewToolbar), |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1706 | 0, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1707 | (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
|
1708 | NULL |
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1711 | 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
|
1712 | "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
|
1713 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1714 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1715 | 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
|
1716 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1717 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1718 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1719 | 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
|
1720 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1721 | GtkWebViewButtons buttons; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1722 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1723 | 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
|
1724 | 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
|
1725 | 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
|
1726 | 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
|
1727 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1728 | toolbar->webview = webview; |
|
32814
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1729 | 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
|
1730 | G_CALLBACK(update_buttons_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1731 | 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
|
1732 | G_CALLBACK(toggle_button_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1733 | 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
|
1734 | G_CALLBACK(update_format_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1735 | 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
|
1736 | 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
|
1737 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1738 | 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
|
1739 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1740 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1741 | 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
|
1742 | 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
|
1743 | 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
|
1744 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1745 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1746 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1747 | 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
|
1748 | 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
|
1749 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1750 | 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
|
1751 | 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
|
1752 | 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
|
1753 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1754 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1755 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1756 | 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
|
1757 | PurpleConversation *conv) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1758 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1759 | 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
|
1760 | 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
|
1761 | 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
|
1762 | |
|
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
|
1763 | 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
|
1764 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1765 | /* 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
|
1766 | 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
|
1767 | 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
|
1768 | 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
|
1769 | 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
|
1770 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1771 |