Sat, 17 Aug 2013 06:08:35 +0530
Merged soc.2013.gobjectification branch
|
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 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
46 | #include "gtk3compat.h" |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
47 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
48 | #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
|
49 | (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
|
50 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
51 | /****************************************************************************** |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
52 | * Structs |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
53 | *****************************************************************************/ |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
54 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
55 | 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
|
56 | 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
|
57 | |
|
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
58 | GtkWidget *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
|
59 | 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
|
60 | |
|
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
61 | GtkWidget *font_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
|
62 | 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
|
63 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
64 | GtkAction *bold; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
65 | GtkAction *italic; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
66 | GtkAction *underline; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
67 | GtkAction *strike; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
68 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
69 | GtkAction *larger_size; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
70 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
71 | GtkAction *normal_size; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
72 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
73 | GtkAction *smaller_size; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
74 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
75 | GtkAction *font; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
76 | GtkAction *fgcolor; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
77 | GtkAction *bgcolor; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
78 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
79 | GtkAction *clear; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
80 | |
|
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
|
81 | GtkWidget *insert_menu; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
82 | GtkAction *image; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
83 | GtkAction *link; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
84 | GtkAction *hr; |
|
32819
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
85 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
86 | GtkAction *smiley; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
87 | GtkAction *attention; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
88 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
89 | GtkWidget *font_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
90 | GtkWidget *fgcolor_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
91 | GtkWidget *bgcolor_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
92 | GtkWidget *link_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
93 | GtkWidget *smiley_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
94 | GtkWidget *image_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
95 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
96 | char *sml; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
97 | } GtkWebViewToolbarPriv; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
98 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
99 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
100 | * Globals |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
101 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
102 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 | 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
|
104 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
105 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
106 | * Prototypes |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
107 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
108 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
109 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
110 | toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
111 | GtkWebViewToolbar *toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
112 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
113 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
114 | * Helpers |
|
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 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
117 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
118 | do_bold(GtkAction *bold, 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
|
119 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
124 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
126 | do_italic(GtkAction *italic, 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
|
127 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 | 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
|
129 | 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
|
130 | 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
|
131 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
134 | do_underline(GtkAction *underline, 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
|
135 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 | 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
|
137 | 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
|
138 | 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
|
139 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
142 | do_strikethrough(GtkAction *strikethrough, 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
|
143 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
150 | do_small(GtkAction *small, 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
|
151 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
152 | g_return_if_fail(toolbar != NULL); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
153 | gtk_webview_font_shrink(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
|
154 | 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
|
155 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
158 | do_big(GtkAction *large, 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
|
159 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
160 | g_return_if_fail(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
161 | gtk_webview_font_grow(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
|
162 | 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
|
163 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
165 | static void |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
166 | destroy_toolbar_font(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
|
167 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
168 | 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
|
169 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
170 | 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
|
171 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
172 | 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
|
173 | 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
|
174 | } |
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
178 | 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
|
179 | { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
180 | #if !GTK_CHECK_VERSION(3,2,0) |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
181 | 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
|
182 | GtkFontSelection *sel; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 | |
|
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
|
184 | 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
|
185 | 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
|
186 | 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
|
187 | 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
|
188 | 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
|
189 | 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
|
190 | 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
|
191 | 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
|
192 | gtk_font_selection_get_family_list(sel)))); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
193 | #endif |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 | static void |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
197 | apply_font(GtkDialog *dialog, gint response, 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
|
198 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 | /* 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
|
200 | but for now only works with font face */ |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
201 | gchar *fontname = NULL; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
202 | |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
203 | if (response == GTK_RESPONSE_OK) |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
204 | fontname = gtk_font_chooser_get_font(GTK_FONT_CHOOSER(dialog)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
205 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 | if (fontname) { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
207 | PangoFontDescription *desc; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
208 | const gchar *family_name; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
209 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
210 | 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
|
211 | 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
|
212 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
213 | 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
|
214 | gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview), |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
215 | family_name); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
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 | 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
|
219 | g_free(fontname); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
220 | } else { |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
221 | gtk_webview_toggle_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
|
222 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
223 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
224 | destroy_toolbar_font(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
225 | } |
|
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 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
228 | toggle_font(GtkAction *font, 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
|
229 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
230 | 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
|
231 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
232 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(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
|
233 | 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
|
234 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
235 | if (!priv->font_dialog) { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
236 | GtkWindow *window; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
237 | window = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar))); |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
238 | priv->font_dialog = gtk_font_chooser_dialog_new(_("Select Font"), window); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
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 (fontname) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
241 | char *fonttif = g_strdup_printf("%s 12", fontname); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
242 | gtk_font_chooser_set_font(GTK_FONT_CHOOSER(priv->font_dialog), |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
243 | fonttif); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
244 | 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
|
245 | } else { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
246 | gtk_font_chooser_set_font(GTK_FONT_CHOOSER(priv->font_dialog), |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
247 | DEFAULT_FONT_FACE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
248 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
249 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
250 | g_signal_connect(G_OBJECT(priv->font_dialog), "response", |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
251 | G_CALLBACK(apply_font), toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
252 | g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize", |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
253 | G_CALLBACK(realize_toolbar_font), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
254 | } |
|
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
|
255 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
256 | 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
|
257 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
258 | 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
|
259 | } else { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
260 | destroy_toolbar_font(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
261 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
262 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
263 | 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
|
264 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
265 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
266 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
267 | 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
|
268 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
269 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
270 | 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
|
271 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
272 | 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
|
273 | 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
|
274 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
275 | 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
|
276 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
277 | 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
|
278 | 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
|
279 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
280 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
281 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
282 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
283 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
284 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
285 | cancel_toolbar_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
|
286 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
287 | 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
|
288 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
289 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
290 | 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
|
291 | 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
|
292 | { |
|
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
|
293 | 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
|
294 | 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
|
295 | 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
|
296 | 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
|
297 | 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
|
298 | |
|
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
|
299 | 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
|
300 | 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
|
301 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
302 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | 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
|
309 | 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
|
310 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
311 | 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
|
312 | } |
|
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 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
315 | toggle_fg_color(GtkAction *color, 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
|
316 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
317 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
318 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
319 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
320 | GtkWidget *colorsel; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
321 | 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
|
322 | 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
|
323 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
324 | 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
|
325 | 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
|
326 | 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
|
327 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
328 | 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
|
329 | 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
|
330 | 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
|
331 | if (color) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
332 | 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
|
333 | 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
|
334 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
335 | |
|
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
|
336 | 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
|
337 | 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
|
338 | 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
|
339 | 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
|
340 | 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
|
341 | 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
|
342 | 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
|
343 | 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
|
344 | } |
|
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
|
345 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
346 | 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
|
347 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
348 | 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
|
349 | } else { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
350 | cancel_toolbar_fgcolor(GTK_WIDGET(toolbar), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
351 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
352 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
353 | 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
|
354 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
355 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
356 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
357 | 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
|
358 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
359 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
364 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
365 | 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
|
366 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
367 | 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
|
368 | 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
|
369 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
370 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
371 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
372 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
373 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
374 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
375 | 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
|
376 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
377 | 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
|
378 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
379 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
380 | static void |
|
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
|
381 | 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
|
382 | { |
|
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
|
383 | 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
|
384 | 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
|
385 | 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
|
386 | 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
|
387 | 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
|
388 | |
|
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
|
389 | 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
|
390 | 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
|
391 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
392 | 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
|
393 | 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
|
394 | 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
|
395 | 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
|
396 | 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
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
401 | 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
|
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 |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
405 | toggle_bg_color(GtkAction *color, 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
|
406 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
407 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
408 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
409 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
410 | GtkWidget *colorsel; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
411 | 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
|
412 | 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
|
413 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
418 | 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
|
419 | 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
|
420 | 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
|
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 | if (color) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
423 | 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
|
424 | 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
|
425 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
426 | |
|
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
|
427 | 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
|
428 | 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
|
429 | &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
|
430 | 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
|
431 | 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
|
432 | 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
|
433 | 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
|
434 | 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
|
435 | 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
|
436 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
437 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
438 | 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
|
439 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
440 | 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
|
441 | } else { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
442 | cancel_toolbar_bgcolor(GTK_WIDGET(toolbar), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
443 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
444 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
445 | 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
|
446 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
447 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
448 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
449 | clear_formatting_cb(GtkAction *clear, 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
|
450 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
451 | gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview)); |
|
33023
35de4c169b1a
This focus grab seems to be in the wrong place.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33019
diff
changeset
|
452 | gtk_widget_grab_focus(toolbar->webview); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
453 | } |
|
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 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
456 | 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
|
457 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
458 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
459 | gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
460 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
461 | 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
|
462 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
463 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
464 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
465 | 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
|
466 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
467 | 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
|
468 | 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
|
469 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
470 | 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
|
471 | priv->link_dialog = NULL; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
472 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
473 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
474 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
475 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
476 | 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
|
477 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
478 | 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
|
479 | 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
|
480 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
481 | 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
|
482 | 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
|
483 | 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
|
484 | else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
485 | description = NULL; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
486 | |
|
33013
f62232fb738a
Restore "Insert Link" functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33012
diff
changeset
|
487 | gtk_webview_insert_link(GTK_WEBVIEW(toolbar->webview), url, description); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
488 | |
|
33019
83a3a76bf86d
Fix a widget type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33017
diff
changeset
|
489 | gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
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 |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
495 | insert_link_cb(GtkAction *action, 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
|
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); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
498 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
499 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->link))) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
500 | PurpleRequestFields *fields; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
501 | PurpleRequestFieldGroup *group; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
502 | PurpleRequestField *field; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
503 | char *msg; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
504 | 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
|
505 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
506 | 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
|
507 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
508 | 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
|
509 | 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
|
510 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
511 | 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
|
512 | 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
|
513 | 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
|
514 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
515 | if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC) { |
|
33014
2f8a83007ab9
Set up the link description from the already selected text.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33013
diff
changeset
|
516 | desc = gtk_webview_get_selected_text(GTK_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
517 | 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
|
518 | desc, FALSE); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
519 | 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
|
520 | 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
|
521 | "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
|
522 | "is optional.")); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
523 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
524 | 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
|
525 | "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
|
526 | } |
|
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 = |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
529 | 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
|
530 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
531 | msg, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
532 | fields, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
533 | _("_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
|
534 | _("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
|
535 | 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
|
536 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
537 | 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
|
538 | 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
|
539 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
540 | 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
|
541 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
542 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
543 | 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
|
544 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
545 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
546 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
547 | insert_hr_cb(GtkAction *action, 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
|
548 | { |
|
33012
3a742f00a0f4
Restore Insert Horizontal Rule functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32896
diff
changeset
|
549 | gtk_webview_insert_hr(GTK_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
550 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
551 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
552 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
553 | 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
|
554 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
555 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
556 | gchar *filename = NULL, *name, *buf; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
557 | char *filedata; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
558 | 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
|
559 | 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
|
560 | int id; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
561 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
562 | if (response == GTK_RESPONSE_ACCEPT) |
|
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
563 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
564 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
565 | /* The following triggers a callback that closes the widget */ |
|
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
566 | gtk_action_activate(priv->image); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
567 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
568 | if (filename == NULL) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
569 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
570 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
571 | 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
|
572 | 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
|
573 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
574 | 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
|
575 | 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
|
576 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
577 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
578 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
579 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
580 | 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
|
581 | |
| 33661 | 582 | id = purple_imgstore_new_with_id(filedata, size, name); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
583 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
588 | 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
|
589 | 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
|
590 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
591 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
592 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
593 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
594 | g_free(filename); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
595 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
596 | gtk_webview_insert_image(GTK_WEBVIEW(toolbar->webview), id); |
|
33398
bb0e3f84034c
Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33277
diff
changeset
|
597 | /* TODO: do it after passing an image to prpl, not before |
|
bb0e3f84034c
Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33277
diff
changeset
|
598 | * purple_imgstore_unref_by_id(id); |
|
bb0e3f84034c
Fix a regression: don't remove sent images before passing them to prpl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33277
diff
changeset
|
599 | */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
600 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
601 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
602 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
603 | insert_image_cb(GtkAction *action, 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
|
604 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
605 | 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
|
606 | GtkWidget *window; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
607 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
608 | if (!priv->image_dialog) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
609 | window = gtk_file_chooser_dialog_new(_("Insert Image"), NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
610 | GTK_FILE_CHOOSER_ACTION_OPEN, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
611 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
612 | GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
613 | NULL); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
614 | gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
615 | g_signal_connect(G_OBJECT(window), "response", |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
616 | G_CALLBACK(do_insert_image_cb), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
617 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
618 | 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
|
619 | 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
|
620 | } else { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
621 | 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
|
622 | 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
|
623 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
624 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
625 | 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
|
626 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
627 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
628 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
629 | 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
|
630 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
631 | 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
|
632 | 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
|
633 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
634 | 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
|
635 | 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
|
636 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
637 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
638 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
639 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
640 | 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
|
641 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
642 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
643 | gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->smiley), FALSE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
644 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
645 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
646 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
647 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
648 | 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
|
649 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
650 | 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
|
651 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
652 | 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
|
653 | 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
|
654 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
655 | gtk_webview_insert_smiley(GTK_WEBVIEW(toolbar->webview), |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
656 | gtk_webview_get_protocol_name(GTK_WEBVIEW(toolbar->webview)), |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
657 | escaped_smiley); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
658 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
659 | 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
|
660 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
661 | 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
|
662 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
663 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
664 | /* 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
|
665 | 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
|
666 | 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
|
667 | GtkWidget *button; |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
668 | const GtkWebViewSmiley *smiley; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
669 | 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
|
670 | }; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
671 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
672 | static 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
|
673 | sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
674 | int *width, const GtkWebViewSmiley *smiley) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
675 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
676 | GtkWidget *image; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
677 | GtkWidget *button; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
678 | GtkRequisition size; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
679 | 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
|
680 | struct smiley_button_list *it, *it_last; |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
681 | const gchar *filename = gtk_webview_smiley_get_file(smiley); |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
682 | const gchar *face = gtk_webview_smiley_get_smile(smiley); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
683 | 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
|
684 | 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
|
685 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
686 | 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
|
687 | it = ls; |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
688 | it_last = ls; /* list iterators */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
689 | 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
|
690 | |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
691 | gtk_widget_get_preferred_size(image, NULL, &size); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
692 | |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
693 | if ((size.width > 24) |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
694 | && (gtk_webview_smiley_get_flags(smiley) & GTK_WEBVIEW_SMILEY_CUSTOM)) { |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
695 | /* This is a custom smiley, let's scale it */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
696 | 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
|
697 | GtkImageType type; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
698 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
699 | 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
|
700 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
701 | 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
|
702 | 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
|
703 | } 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
|
704 | GdkPixbufAnimation *animation; |
|
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 | 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
|
707 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
708 | 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
|
709 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
710 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
711 | 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
|
712 | GdkPixbuf *resized; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
713 | 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
|
714 | 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
|
715 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
716 | gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */ |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
717 | gtk_widget_get_preferred_size(image, NULL, &size); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
718 | 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
|
719 | } |
|
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
722 | (*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
|
723 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
724 | 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
|
725 | 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
|
726 | |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
727 | g_object_set_data_full(G_OBJECT(button), "smiley_text", g_strdup(face), g_free); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
728 | 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
|
729 | |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
730 | 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
|
731 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
732 | /* 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
|
733 | 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
|
734 | |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
735 | psmiley = purple_smileys_find_by_shortcut(face); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
736 | /* 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
|
737 | "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
|
738 | is custom smiley-enabled */ |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
739 | if (supports_custom && psmiley |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
740 | && !(gtk_webview_smiley_get_flags(smiley) & GTK_WEBVIEW_SMILEY_CUSTOM)) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
741 | 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
|
742 | 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
|
743 | _("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
|
744 | face); |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
745 | 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
|
746 | 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
|
747 | } 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
|
748 | /* 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
|
749 | 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
|
750 | 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
|
751 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
752 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
753 | /* 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
|
754 | 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
|
755 | 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
|
756 | 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
|
757 | 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
|
758 | 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
|
759 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
760 | /* 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
|
761 | 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
|
762 | return cur; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
763 | 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
|
764 | 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
|
765 | 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
|
766 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
767 | 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
|
768 | 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
|
769 | return ls; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
770 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
771 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
772 | static gboolean |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
773 | smiley_is_unique(GSList *list, GtkWebViewSmiley *smiley) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
774 | { |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
775 | const char *file = gtk_webview_smiley_get_file(smiley); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
776 | while (list) { |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
777 | GtkWebViewSmiley *cur = (GtkWebViewSmiley *)list->data; |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
778 | if (!strcmp(gtk_webview_smiley_get_file(cur), file)) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
779 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
780 | 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
|
781 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
782 | return TRUE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
783 | } |
|
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 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
786 | 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
|
787 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
788 | { |
|
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
|
789 | 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
|
790 | (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
|
791 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
792 | 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
|
793 | return TRUE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
794 | } |
|
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 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
797 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
798 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
799 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
800 | 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
|
801 | 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
|
802 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
803 | GtkWidget *line; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
804 | 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
|
805 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
806 | if (!list) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
807 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
808 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
809 | 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
|
810 | 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
|
811 | for (; list; list = list->next) { |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
812 | if (custom != !!(gtk_webview_smiley_get_flags(list->smiley) & GTK_WEBVIEW_SMILEY_CUSTOM)) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
813 | continue; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
814 | 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
|
815 | 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
|
816 | 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
|
817 | 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
|
818 | 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
|
819 | 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
|
820 | 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
|
821 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
822 | 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
|
823 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
824 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
825 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
826 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
827 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
828 | insert_smiley_cb(GtkAction *smiley, 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
|
829 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
830 | 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
|
831 | 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
|
832 | 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
|
833 | 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
|
834 | 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
|
835 | 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
|
836 | GtkRequisition req; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
837 | 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
|
838 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
839 | if (!gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(smiley))) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
840 | 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
|
841 | 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
|
842 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
843 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
844 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
845 | if (priv->sml) |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
846 | 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
|
847 | else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
848 | 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
|
849 | |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
850 | /* Note: prepend smileys to list to avoid O(n^2) overhead when there is a |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
851 | large number of smileys... need to reverse the list after for the dialog |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
852 | to work... */ |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
853 | while (smileys) { |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
854 | GtkWebViewSmiley *smiley = (GtkWebViewSmiley *)smileys->data; |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
855 | if (!gtk_webview_smiley_get_hidden(smiley)) { |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
856 | if (smiley_is_unique(unique_smileys, smiley)) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
857 | 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
|
858 | } |
|
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 | 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
|
861 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
862 | 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
|
863 | 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
|
864 | 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
|
865 | 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
|
866 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
867 | 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
|
868 | iterator = g_slist_next(iterator)) { |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
869 | GtkWebViewSmiley *smiley = (GtkWebViewSmiley *)iterator->data; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
870 | 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
|
871 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
872 | } |
|
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 | /* 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
|
875 | 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
|
876 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
877 | 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
|
878 | 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
|
879 | 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
|
880 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
881 | 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
|
882 | 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
|
883 | 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
|
884 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
885 | /* 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
|
886 | ls = NULL; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
887 | 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
|
888 | 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
|
889 | 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
|
890 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
891 | 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
|
892 | 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
|
893 | GtkRequisition req; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
894 | 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
|
895 | 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
|
896 | 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
|
897 | 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
|
898 | gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0); |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
899 | gtk_widget_get_preferred_size(manage, NULL, &req); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
900 | 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
|
901 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
902 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
903 | /* 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
|
904 | while (unique_smileys) { |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
905 | GtkWebViewSmiley *smiley = (GtkWebViewSmiley *)unique_smileys->data; |
|
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
906 | if (!gtk_webview_smiley_get_hidden(smiley)) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
907 | 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
|
908 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
909 | 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
|
910 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
911 | /* 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
|
912 | 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
|
913 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
914 | /* 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
|
915 | 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
|
916 | 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
|
917 | 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
|
918 | 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
|
919 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
920 | while (ls) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
921 | 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
|
922 | 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
|
923 | ls = tmp; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
924 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
925 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
926 | 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
|
927 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
928 | else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
929 | 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
|
930 | 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
|
931 | 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
|
932 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
933 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
934 | 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
|
935 | 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
|
936 | 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
|
937 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
938 | 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
|
939 | 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
|
940 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
941 | /* connect signals */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
942 | 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
|
943 | 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
|
944 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
945 | 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
|
946 | 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
|
947 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
948 | /* show everything */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
949 | 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
|
950 | |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
951 | gtk_widget_get_preferred_size(viewport, NULL, &req); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
952 | 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
|
953 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
954 | /* 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
|
955 | * 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
|
956 | * 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
|
957 | * 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
|
958 | * 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
|
959 | 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
|
960 | 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
|
961 | "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
|
962 | "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
|
963 | NULL); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
964 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
965 | #ifdef _WIN32 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
966 | 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
|
967 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
968 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
969 | 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
|
970 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
971 | 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
|
972 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
973 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
974 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
975 | send_attention_cb(GtkAction *attention, 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
|
976 | { |
|
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
|
977 | 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
|
978 | 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
|
979 | 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
|
980 | 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
|
981 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
982 | 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
|
983 | 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
|
984 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
985 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
986 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
987 | 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
|
988 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
989 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
990 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
991 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
992 | gtk_action_set_sensitive(priv->bold, buttons & GTK_WEBVIEW_BOLD); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
993 | gtk_action_set_sensitive(priv->italic, buttons & GTK_WEBVIEW_ITALIC); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
994 | gtk_action_set_sensitive(priv->underline, buttons & GTK_WEBVIEW_UNDERLINE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
995 | gtk_action_set_sensitive(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
|
996 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
997 | gtk_action_set_sensitive(priv->larger_size, buttons & GTK_WEBVIEW_GROW); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
998 | gtk_action_set_sensitive(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
|
999 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1000 | gtk_action_set_sensitive(priv->font, buttons & GTK_WEBVIEW_FACE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1001 | gtk_action_set_sensitive(priv->fgcolor, buttons & GTK_WEBVIEW_FORECOLOR); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1002 | gtk_action_set_sensitive(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
|
1003 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1004 | gtk_action_set_sensitive(priv->clear, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1005 | (buttons & GTK_WEBVIEW_BOLD || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1006 | buttons & GTK_WEBVIEW_ITALIC || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1007 | buttons & GTK_WEBVIEW_UNDERLINE || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1008 | buttons & GTK_WEBVIEW_STRIKE || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1009 | buttons & GTK_WEBVIEW_GROW || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1010 | buttons & GTK_WEBVIEW_SHRINK || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1011 | buttons & GTK_WEBVIEW_FACE || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1012 | buttons & GTK_WEBVIEW_FORECOLOR || |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1013 | 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
|
1014 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1015 | gtk_action_set_sensitive(priv->image, buttons & GTK_WEBVIEW_IMAGE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1016 | gtk_action_set_sensitive(priv->link, buttons & GTK_WEBVIEW_LINK); |
|
34283
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1017 | gtk_action_set_sensitive(priv->smiley, (buttons & GTK_WEBVIEW_SMILEY) && |
|
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1018 | 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
|
1019 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1020 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1021 | /* we call this when we want to _set_active the toggle button, it'll |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1022 | * block the callback that's connected to the button so we don't have to |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1023 | * 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
|
1024 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1025 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1026 | toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1027 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1028 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1029 | GObject *object; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1030 | 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
|
1031 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1032 | object = g_object_ref(action); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1033 | g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1034 | 0, 0, NULL, NULL, toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1035 | gtk_toggle_action_set_active(action, is_active); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1036 | g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1037 | 0, 0, NULL, NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1038 | 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
|
1039 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1040 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1041 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1042 | 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
|
1043 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1044 | 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
|
1045 | 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
|
1046 | char *tmp; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1047 | char *label; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1048 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1049 | label = g_strdup(_("_Font")); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1050 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1051 | 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
|
1052 | &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
|
1053 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1054 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->bold)) != bold) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1055 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bold), bold, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1056 | toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1057 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->italic)) != italic) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1058 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->italic), italic, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1059 | toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1060 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->underline)) != underline) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1061 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->underline), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1062 | underline, toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1063 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->strike)) != strike) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1064 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->strike), strike, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1065 | toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1066 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1067 | if (bold) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1068 | gchar *markup = g_strdup_printf("<b>%s</b>", label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1069 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1070 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1071 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1072 | if (italic) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1073 | gchar *markup = g_strdup_printf("<i>%s</i>", label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1074 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1075 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1076 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1077 | if (underline) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1078 | gchar *markup = g_strdup_printf("<u>%s</u>", label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1079 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1080 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1081 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1082 | if (strike) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1083 | gchar *markup = g_strdup_printf("<s>%s</s>", label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1084 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1085 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1086 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1087 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1088 | tmp = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1089 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->font), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1090 | (tmp && *tmp), toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1091 | if (tmp && *tmp) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1092 | gchar *markup = g_strdup_printf("<span font_desc=\"%s\">%s</span>", |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1093 | tmp, label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1094 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1095 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1096 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1097 | 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
|
1098 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1099 | tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); |
|
34298
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1100 | /* TODO: rgb()/rgba() colors are not supported by GTK, so let's get rid |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1101 | * of such warnings for now. There are two solutions: rewrite those |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1102 | * colors to #aabbcc or implement the toolbar in javascript. |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1103 | */ |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1104 | if (tmp && strncmp(tmp, "rgb", 3) == 0) |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1105 | tmp[0] = '\0'; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1106 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->fgcolor), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1107 | (tmp && *tmp), toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1108 | if (tmp && *tmp) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1109 | gchar *markup = g_strdup_printf("<span foreground=\"%s\">%s</span>", |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1110 | tmp, label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1111 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1112 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1113 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1114 | 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
|
1115 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1116 | tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); |
|
34298
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1117 | /* TODO: see comment above */ |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1118 | if (tmp && strncmp(tmp, "rgb", 3) == 0) |
|
0636daf13ce3
Get rid of another warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34283
diff
changeset
|
1119 | tmp[0] = '\0'; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1120 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bgcolor), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1121 | (tmp && *tmp), toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1122 | if (tmp && *tmp) { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1123 | gchar *markup = g_strdup_printf("<span background=\"%s\">%s</span>", |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1124 | tmp, label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1125 | g_free(label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1126 | label = markup; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1127 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1128 | g_free(tmp); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1129 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1130 | gtk_label_set_markup_with_mnemonic(GTK_LABEL(priv->font_label), label); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1131 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1132 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1133 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1134 | 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
|
1135 | GtkWebViewToolbar *toolbar) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1136 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1137 | 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
|
1138 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1139 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1140 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1141 | 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
|
1142 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1143 | 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
|
1144 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1145 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1146 | static void |
|
33029
5005e63a35d4
Update the toolbar when the caret moves.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33023
diff
changeset
|
1147 | mark_set_cb(GtkWebView *webview, 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
|
1148 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1149 | 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
|
1150 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1151 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1152 | /* 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
|
1153 | * 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
|
1154 | * 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
|
1155 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1156 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1157 | menu_position_func(GtkMenu *menu, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1158 | int *x, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1159 | int *y, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1160 | gboolean *push_in, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1161 | gpointer data) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1162 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1163 | 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
|
1164 | 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
|
1165 | 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
|
1166 | 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
|
1167 | int savy; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1168 | |
|
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
|
1169 | gtk_widget_get_allocation(widget, &allocation); |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
1170 | gtk_widget_get_preferred_size(GTK_WIDGET(menu), NULL, &menu_req); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1171 | 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
|
1172 | *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
|
1173 | *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
|
1174 | savy = *y; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1175 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1176 | 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
|
1177 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1178 | 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
|
1179 | *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
|
1180 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1181 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1182 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1183 | 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
|
1184 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1185 | if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(button))) { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1186 | gtk_widget_show_all(GTK_WIDGET(menu)); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1187 | gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time()); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1188 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1189 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1190 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1191 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1192 | 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
|
1193 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1194 | gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(button), FALSE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1195 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1196 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1197 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1198 | switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1199 | { |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1200 | 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
|
1201 | !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
|
1202 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1203 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1204 | static gboolean |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1205 | 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
|
1206 | GtkWebViewToolbar *toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1207 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1208 | 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
|
1209 | GtkWidget *menu; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1210 | GtkWidget *item; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1211 | gboolean wide; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1212 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1213 | if (event->button != 3) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1214 | return FALSE; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1215 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1216 | wide = gtk_widget_get_visible(priv->wide_view); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1217 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1218 | menu = gtk_menu_new(); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1219 | 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
|
1220 | 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
|
1221 | 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
|
1222 | gtk_widget_show(item); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1223 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1224 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1225 | widget, event->button, event->time); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1226 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1227 | return TRUE; |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1228 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1229 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1230 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1231 | enable_markup(GtkWidget *widget, gpointer null) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1232 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1233 | GtkWidget *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1234 | label = gtk_bin_get_child(GTK_BIN(widget)); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1235 | if (GTK_IS_LABEL(label)) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1236 | g_object_set(G_OBJECT(label), "use-markup", TRUE, NULL); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1237 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1238 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1239 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1240 | 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
|
1241 | gconstpointer value, gpointer toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1242 | { |
|
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
|
1243 | 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
|
1244 | 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
|
1245 | 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
|
1246 | 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
|
1247 | } 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
|
1248 | 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
|
1249 | 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
|
1250 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1251 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1252 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1253 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1254 | * GObject stuff |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1255 | *****************************************************************************/ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1256 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1257 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1258 | 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
|
1259 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1260 | 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
|
1261 | 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
|
1262 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1263 | 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
|
1264 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1265 | 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
|
1266 | 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
|
1267 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1268 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
1269 | destroy_toolbar_font(toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1270 | if (priv->smiley_dialog != NULL) { |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1271 | 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
|
1272 | 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
|
1273 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1274 | 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
|
1275 | 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
|
1276 | 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
|
1277 | 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
|
1278 | 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
|
1279 | 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
|
1280 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1281 | #if 0 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1282 | 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
|
1283 | 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
|
1284 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1285 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1286 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1287 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1288 | g_free(priv->sml); |
|
32820
d8ad578dad76
Add some GTK+3 compatible updates.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32819
diff
changeset
|
1289 | |
|
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
|
1290 | 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
|
1291 | 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
|
1292 | 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
|
1293 | 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
|
1294 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1295 | 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
|
1296 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1297 | G_OBJECT_CLASS(parent_class)->finalize(object); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1298 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1299 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1300 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1301 | 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
|
1302 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1303 | 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
|
1304 | 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
|
1305 | 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
|
1306 | 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
|
1307 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1308 | 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
|
1309 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1310 | 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
|
1311 | 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
|
1312 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1313 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1314 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1315 | gtk_webviewtoolbar_create_actions(GtkWebViewToolbar *toolbar) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1316 | { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1317 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1318 | GtkActionGroup *action_group; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1319 | int i; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1320 | struct { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1321 | GtkAction **action; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1322 | char *name; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1323 | char *stock; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1324 | char *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1325 | char *tooltip; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1326 | void (*cb)(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1327 | gboolean toggle; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1328 | } actions[] = { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1329 | {&priv->bold, "ToggleBold", GTK_STOCK_BOLD, N_("<b>_Bold</b>"), N_("Bold"), do_bold, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1330 | {&priv->italic, "ToggleItalic", GTK_STOCK_ITALIC, N_("<i>_Italic</i>"), N_("Italic"), do_italic, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1331 | {&priv->underline, "ToggleUnderline", GTK_STOCK_UNDERLINE, N_("<u>_Underline</u>"), N_("Underline"), do_underline, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1332 | {&priv->strike, "ToggleStrike", GTK_STOCK_STRIKETHROUGH, N_("<span strikethrough='true'>Strikethrough</span>"), N_("Strikethrough"), do_strikethrough, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1333 | {&priv->larger_size, "ToggleLarger", PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, N_("<span size='larger'>Larger</span>"), N_("Increase Font Size"), do_big, FALSE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1334 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1335 | {&priv->normal_size, "ToggleNormal", NULL, N_("Normal"), N_("Normal Font Size"), NULL, FALSE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1336 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1337 | {&priv->smaller_size, "ToggleSmaller", PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, N_("<span size='smaller'>Smaller</span>"), N_("Decrease Font Size"), do_small, FALSE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1338 | {&priv->font, "ToggleFontFace", PIDGIN_STOCK_TOOLBAR_FONT_FACE, N_("_Font face"), N_("Font Face"), toggle_font, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1339 | {&priv->fgcolor, "ToggleFG", PIDGIN_STOCK_TOOLBAR_FGCOLOR, N_("Foreground _color"), N_("Foreground Color"), toggle_fg_color, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1340 | {&priv->bgcolor, "ToggleBG", PIDGIN_STOCK_TOOLBAR_BGCOLOR, N_("Bac_kground color"), N_("Background Color"), toggle_bg_color, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1341 | {&priv->clear, "ResetFormat", PIDGIN_STOCK_CLEAR, N_("_Reset formatting"), N_("Reset Formatting"), clear_formatting_cb, FALSE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1342 | {&priv->image, "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("_Image"), N_("Insert IM Image"), insert_image_cb, FALSE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1343 | {&priv->link, "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("_Link"), N_("Insert Link"), insert_link_cb, TRUE}, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1344 | {&priv->hr, "InsertHR", NULL, N_("_Horizontal rule"), N_("Insert Horizontal rule"), insert_hr_cb, FALSE}, |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
1345 | {&priv->smiley, "InsertSmiley", PIDGIN_STOCK_TOOLBAR_SMILEY, N_("_Smile!"), N_("Insert Smiley"), insert_smiley_cb, TRUE}, |
|
34282
6de6ea85df26
Make Get/Send Attention strings consistent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34281
diff
changeset
|
1346 | {&priv->attention, "SendAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("_Attention!"), N_("Get Attention"), send_attention_cb, FALSE}, |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1347 | }; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1348 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1349 | action_group = gtk_action_group_new("GtkWebViewToolbar"); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1350 | #ifdef ENABLE_NLS |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1351 | gtk_action_group_set_translation_domain(action_group, PACKAGE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1352 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1353 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1354 | for (i = 0; i < G_N_ELEMENTS(actions); i++) { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1355 | GtkAction *action; |
|
34281
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1356 | if (actions[i].toggle) { |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1357 | action = GTK_ACTION(gtk_toggle_action_new( |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1358 | actions[i].name, _(actions[i].label), |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1359 | _(actions[i].tooltip), actions[i].stock)); |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1360 | } else { |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1361 | action = gtk_action_new(actions[i].name, |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1362 | _(actions[i].label), _(actions[i].tooltip), |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1363 | actions[i].stock); |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1364 | } |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1365 | gtk_action_set_is_important(action, TRUE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1366 | gtk_action_group_add_action(action_group, action); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1367 | g_signal_connect(G_OBJECT(action), "activate", actions[i].cb, toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1368 | *(actions[i].action) = action; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1369 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1370 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1371 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1372 | static void |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1373 | gtk_webviewtoolbar_create_wide_view(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
|
1374 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1375 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1376 | GtkAction *layout[] = { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1377 | priv->bold, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1378 | priv->italic, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1379 | priv->underline, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1380 | priv->strike, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1381 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1382 | priv->larger_size, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1383 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1384 | priv->normal_size, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1385 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1386 | priv->smaller_size, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1387 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1388 | priv->font, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1389 | priv->fgcolor, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1390 | priv->bgcolor, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1391 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1392 | priv->clear, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1393 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1394 | priv->image, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1395 | priv->link, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1396 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1397 | priv->smiley, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1398 | 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
|
1399 | }; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1400 | int i; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1401 | GtkToolItem *item; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1402 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1403 | priv->wide_view = gtk_toolbar_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1404 | gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->wide_view), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1405 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1406 | gtk_toolbar_set_style(GTK_TOOLBAR(priv->wide_view), GTK_TOOLBAR_ICONS); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1407 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1408 | for (i = 0; i < G_N_ELEMENTS(layout); i++) { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1409 | if (layout[i]) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1410 | item = GTK_TOOL_ITEM(gtk_action_create_tool_item(layout[i])); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1411 | else |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1412 | item = gtk_separator_tool_item_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1413 | gtk_toolbar_insert(GTK_TOOLBAR(priv->wide_view), item, -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1414 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1415 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1416 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1417 | static void |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1418 | gtk_webviewtoolbar_create_lean_view(GtkWebViewToolbar *toolbar) |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1419 | { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1420 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1421 | GtkWidget *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1422 | GtkWidget *menuitem; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1423 | GtkToolItem *sep; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1424 | GtkToolItem *font_button; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1425 | GtkWidget *font_menu; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1426 | GtkToolItem *insert_button; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1427 | GtkWidget *insert_menu; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1428 | GtkWidget *smiley_button; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1429 | GtkWidget *attention_button; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1430 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1431 | priv->lean_view = gtk_toolbar_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1432 | gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->lean_view), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1433 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1434 | gtk_toolbar_set_style(GTK_TOOLBAR(priv->lean_view), GTK_TOOLBAR_BOTH_HORIZ); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1435 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1436 | #define ADD_MENU_ITEM(menu, item) \ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1437 | menuitem = gtk_action_create_menu_item((item)); \ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1438 | gtk_menu_shell_append(GTK_MENU_SHELL((menu)), menuitem); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1439 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1440 | /* Fonts */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1441 | font_button = gtk_toggle_tool_button_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1442 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), font_button, -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1443 | gtk_tool_item_set_is_important(font_button, TRUE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1444 | gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(font_button), GTK_STOCK_BOLD); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1445 | priv->font_label = label = gtk_label_new_with_mnemonic(_("_Font")); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1446 | gtk_label_set_use_markup(GTK_LABEL(label), TRUE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1447 | gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(font_button), label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1448 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1449 | 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
|
1450 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1451 | ADD_MENU_ITEM(font_menu, priv->bold); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1452 | ADD_MENU_ITEM(font_menu, priv->italic); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1453 | ADD_MENU_ITEM(font_menu, priv->underline); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1454 | ADD_MENU_ITEM(font_menu, priv->strike); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1455 | ADD_MENU_ITEM(font_menu, priv->larger_size); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1456 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1457 | ADD_MENU_ITEM(font_menu, priv->normal_size); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1458 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1459 | ADD_MENU_ITEM(font_menu, priv->smaller_size); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1460 | ADD_MENU_ITEM(font_menu, priv->font); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1461 | ADD_MENU_ITEM(font_menu, priv->fgcolor); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1462 | ADD_MENU_ITEM(font_menu, priv->bgcolor); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1463 | ADD_MENU_ITEM(font_menu, priv->clear); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1464 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1465 | g_signal_connect(G_OBJECT(font_button), "toggled", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1466 | G_CALLBACK(pidgin_menu_clicked), font_menu); |
|
33196
e3d6afee499c
Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
1467 | g_signal_connect_object(G_OBJECT(font_menu), "deactivate", |
|
e3d6afee499c
Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
1468 | G_CALLBACK(pidgin_menu_deactivate), font_button, 0); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1469 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1470 | gtk_container_foreach(GTK_CONTAINER(font_menu), enable_markup, NULL); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1471 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1472 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1473 | sep = gtk_separator_tool_item_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1474 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1475 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1476 | /* Insert */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1477 | insert_button = gtk_toggle_tool_button_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1478 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), insert_button, -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1479 | gtk_tool_item_set_is_important(insert_button, TRUE); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1480 | gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(insert_button), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1481 | PIDGIN_STOCK_TOOLBAR_INSERT); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1482 | label = gtk_label_new_with_mnemonic(_("_Insert")); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1483 | gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(insert_button), label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1484 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1485 | priv->insert_menu = insert_menu = gtk_menu_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1486 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1487 | ADD_MENU_ITEM(insert_menu, priv->image); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1488 | ADD_MENU_ITEM(insert_menu, priv->link); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1489 | ADD_MENU_ITEM(insert_menu, priv->hr); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1490 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1491 | g_signal_connect(G_OBJECT(insert_button), "toggled", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1492 | G_CALLBACK(pidgin_menu_clicked), insert_menu); |
|
33196
e3d6afee499c
Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
1493 | g_signal_connect_object(G_OBJECT(insert_menu), "deactivate", |
|
e3d6afee499c
Prevent an assert by taking an extra ref on some objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
1494 | G_CALLBACK(pidgin_menu_deactivate), insert_button, 0); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1495 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1496 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1497 | sep = gtk_separator_tool_item_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1498 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1499 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1500 | /* Smiley */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1501 | smiley_button = gtk_action_create_tool_item(priv->smiley); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1502 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1503 | GTK_TOOL_ITEM(smiley_button), -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1504 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1505 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1506 | sep = gtk_separator_tool_item_new(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1507 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1508 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1509 | /* Attention */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1510 | attention_button = gtk_action_create_tool_item(priv->attention); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1511 | gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1512 | GTK_TOOL_ITEM(attention_button), -1); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1513 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1514 | #undef ADD_MENU_ITEM |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1515 | } |
|
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 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1518 | 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
|
1519 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1520 | GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1521 | GtkWidget *hbox = GTK_WIDGET(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1522 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1523 | gtk_webviewtoolbar_create_actions(toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1524 | gtk_webviewtoolbar_create_wide_view(toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1525 | gtk_webviewtoolbar_create_lean_view(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1526 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1527 | gtk_box_pack_start(GTK_BOX(hbox), priv->wide_view, TRUE, TRUE, 0); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1528 | gtk_box_pack_start(GTK_BOX(hbox), priv->lean_view, TRUE, TRUE, 0); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1529 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1530 | 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
|
1531 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1532 | /* set attention button to be greyed out until we get a conversation */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1533 | gtk_action_set_sensitive(priv->attention, FALSE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1534 | |
|
34283
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1535 | gtk_action_set_sensitive(priv->smiley, |
|
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1536 | (gboolean)pidgin_themes_get_proto_smileys(NULL)); |
|
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1537 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1538 | purple_prefs_connect_callback(toolbar, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1539 | PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1540 | webviewtoolbar_view_pref_changed, toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1541 | g_signal_connect_data(G_OBJECT(toolbar), "realize", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1542 | G_CALLBACK(purple_prefs_trigger_callback), |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1543 | PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1544 | NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1545 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1546 | g_signal_connect(G_OBJECT(hbox), "button-press-event", |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1547 | G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1548 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1549 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1550 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1551 | * Public API |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1552 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1553 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1554 | GtkWidget * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1555 | 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
|
1556 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1557 | 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
|
1558 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1559 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1560 | GType |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1561 | 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
|
1562 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1563 | 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
|
1564 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1565 | 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
|
1566 | 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
|
1567 | sizeof(GtkWebViewToolbarClass), |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1568 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1569 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1570 | (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
|
1571 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1572 | NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1573 | sizeof(GtkWebViewToolbar), |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1574 | 0, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1575 | (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
|
1576 | NULL |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1577 | }; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1578 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1579 | 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
|
1580 | "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
|
1581 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1582 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1583 | 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
|
1584 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1585 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1586 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1587 | 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
|
1588 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1589 | GtkWebViewButtons buttons; |
|
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 | 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
|
1592 | 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
|
1593 | 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
|
1594 | 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
|
1595 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1596 | toolbar->webview = webview; |
|
32814
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1597 | 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
|
1598 | G_CALLBACK(update_buttons_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1599 | 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
|
1600 | G_CALLBACK(toggle_button_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1601 | 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
|
1602 | G_CALLBACK(update_format_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1603 | 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
|
1604 | G_CALLBACK(update_format_cb), toolbar); |
|
33029
5005e63a35d4
Update the toolbar when the caret moves.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33023
diff
changeset
|
1605 | g_signal_connect_after(G_OBJECT(webview), "selection-changed", |
|
5005e63a35d4
Update the toolbar when the caret moves.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33023
diff
changeset
|
1606 | G_CALLBACK(mark_set_cb), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1607 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1608 | 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
|
1609 | 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
|
1610 | 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
|
1611 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1612 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1613 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1614 | 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
|
1615 | 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
|
1616 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1617 | 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
|
1618 | 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
|
1619 | 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
|
1620 | } |
|
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 | void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1623 | 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
|
1624 | PurpleConversation *conv) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1625 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1626 | 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
|
1627 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
36424
477889a0073c
Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
1628 | PurplePluginProtocolInfo *prpl_info = purple_connection_get_protocol_info(gc); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1629 | |
|
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
|
1630 | 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
|
1631 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1632 | /* 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
|
1633 | for the time being it is always disabled for chats */ |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1634 | gtk_action_set_sensitive(priv->attention, |
|
36424
477889a0073c
Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
1635 | conv && prpl_info && PURPLE_IS_IM_CONVERSATION(conv) && |
|
477889a0073c
Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents:
36362
diff
changeset
|
1636 | prpl_info->send_attention != NULL); |
|
34283
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1637 | |
|
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1638 | gtk_action_set_sensitive(priv->smiley, |
|
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1639 | (gboolean)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
|
1640 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1641 | |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1642 | void |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1643 | gtk_webviewtoolbar_activate(GtkWebViewToolbar *toolbar, |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1644 | GtkWebViewAction action) |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1645 | { |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1646 | GtkWebViewToolbarPriv *priv; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1647 | GtkAction *act; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1648 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1649 | g_return_if_fail(toolbar != NULL); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1650 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1651 | priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1652 | switch (action) { |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1653 | case GTK_WEBVIEW_ACTION_BOLD: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1654 | act = priv->bold; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1655 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1656 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1657 | case GTK_WEBVIEW_ACTION_ITALIC: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1658 | act = priv->italic; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1659 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1660 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1661 | case GTK_WEBVIEW_ACTION_UNDERLINE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1662 | act = priv->underline; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1663 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1664 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1665 | case GTK_WEBVIEW_ACTION_STRIKE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1666 | act = priv->strike; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1667 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1668 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1669 | case GTK_WEBVIEW_ACTION_LARGER: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1670 | act = priv->larger_size; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1671 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1672 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1673 | #if 0 |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1674 | case GTK_WEBVIEW_ACTION_NORMAL: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1675 | act = priv->normal_size; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1676 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1677 | #endif |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1678 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1679 | case GTK_WEBVIEW_ACTION_SMALLER: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1680 | act = priv->smaller_size; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1681 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1682 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1683 | case GTK_WEBVIEW_ACTION_FONTFACE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1684 | act = priv->font; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1685 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1686 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1687 | case GTK_WEBVIEW_ACTION_FGCOLOR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1688 | act = priv->fgcolor; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1689 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1690 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1691 | case GTK_WEBVIEW_ACTION_BGCOLOR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1692 | act = priv->bgcolor; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1693 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1694 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1695 | case GTK_WEBVIEW_ACTION_CLEAR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1696 | act = priv->clear; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1697 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1698 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1699 | case GTK_WEBVIEW_ACTION_IMAGE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1700 | act = priv->image; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1701 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1702 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1703 | case GTK_WEBVIEW_ACTION_LINK: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1704 | act = priv->link; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1705 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1706 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1707 | case GTK_WEBVIEW_ACTION_HR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1708 | act = priv->hr; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1709 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1710 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1711 | case GTK_WEBVIEW_ACTION_SMILEY: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1712 | act = priv->smiley; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1713 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1714 | |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
1715 | case GTK_WEBVIEW_ACTION_ATTENTION: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1716 | act = priv->attention; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1717 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1718 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1719 | default: |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1720 | g_return_if_reached(); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1721 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1722 | } |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1723 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1724 | gtk_action_activate(act); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1725 | } |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1726 |