Mon, 20 May 2019 21:50:28 -0500
remove a few more references to webview
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 | /* pidgin |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 | * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 | * source distribution. |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 | * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 | * under the terms of the GNU General Public License as published by |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 | * GNU General Public License for more details. |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 | * |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 | #include "internal.h" |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 | #include "pidgin.h" |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 | |
|
35815
d6fe2c2ebbbe
imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
25 | #include "image-store.h" |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 | #include "notify.h" |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 | #include "prefs.h" |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 | #include "request.h" |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 | #include "pidginstock.h" |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
30 | #include "smiley-custom.h" |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
31 | #include "smiley-list.h" |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 | #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
|
33 | #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
|
34 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
35 | #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
|
36 | #include "gtkwebviewtoolbar.h" |
|
35718
83486b5d34ab
Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35717
diff
changeset
|
37 | #include "gtksmiley-manager.h" |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
38 | #include "gtksmiley-theme.h" |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 | #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
|
40 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 | #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
|
42 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
43 | #include "gtk3compat.h" |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
44 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
45 | #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT "sans-serif" |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
46 | #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_BGCOLOR "inherit" |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
47 | #define PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FGCOLOR "#000000" |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
48 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
49 | /****************************************************************************** |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
50 | * Structs |
|
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 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
53 | typedef struct _PidginWebViewToolbarPrivate { |
|
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
|
54 | 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
|
55 | |
|
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 | 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
|
57 | 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
|
58 | |
|
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 *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
|
60 | 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
|
61 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
62 | GtkAction *bold; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
63 | GtkAction *italic; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
64 | GtkAction *underline; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
65 | GtkAction *strike; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
66 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
67 | 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
|
68 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
69 | 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
|
70 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
71 | 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
|
72 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
73 | GtkAction *font; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
74 | GtkAction *fgcolor; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
75 | GtkAction *bgcolor; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
76 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
77 | GtkAction *clear; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
78 | |
|
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
|
79 | 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
|
80 | GtkAction *image; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
81 | GtkAction *link; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
82 | 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
|
83 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
84 | GtkAction *smiley; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
85 | GtkAction *attention; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
86 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
87 | GtkWidget *font_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
88 | GtkWidget *fgcolor_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
89 | GtkWidget *bgcolor_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
90 | GtkWidget *link_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
91 | GtkWidget *smiley_dialog; |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
92 | GtkWidget *image_dialog; |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
93 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
94 | gboolean allow_smileys; |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
95 | } PidginWebViewToolbarPrivate; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
96 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
97 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
98 | * Globals |
|
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 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
101 | G_DEFINE_TYPE_WITH_PRIVATE(PidginWebViewToolbar, pidgin_webviewtoolbar, |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
102 | GTK_TYPE_BOX); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
104 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
105 | * Prototypes |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
106 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
107 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
108 | 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
|
109 | toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
110 | PidginWebViewToolbar *toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
111 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
112 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
113 | * Helpers |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
114 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
115 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
116 | static gboolean |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
117 | pidgin_color_parse(const gchar *str, GdkRGBA *color) |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
118 | { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
119 | GdkRGBA dummy_color; |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
120 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
121 | if (str == NULL) |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
122 | return FALSE; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
123 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
124 | while (isspace(str[0])) |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
125 | str++; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
126 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
127 | if (str[0] == '\0') |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
128 | return FALSE; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
129 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
130 | if (color == NULL) |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
131 | color = &dummy_color; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
132 | |
|
38275
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
133 | if (strcmp(str, "inherit") == 0) { |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
134 | return FALSE; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
135 | } |
|
38275
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
136 | |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
137 | if (!gdk_rgba_parse(color, str)) { |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
138 | return FALSE; |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
139 | } |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
140 | |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
141 | /* FALSE for fully transparent color (same behavior as with "inherit") */ |
|
4616ae5456f8
gtkwebviewtoolbar: actually check alpha channel in pidgin_color_parse()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38274
diff
changeset
|
142 | return color->alpha > 0; |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
143 | } |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
144 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
145 | static gchar* |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
146 | pidgin_color_to_str(GdkRGBA *color) |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
147 | { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
148 | return g_strdup_printf("#%02X%02X%02X", |
|
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
149 | (unsigned int)(color->red * 255), |
|
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
150 | (unsigned int)(color->green * 255), |
|
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
151 | (unsigned int)(color->blue * 255)); |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
152 | } |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
153 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
154 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
155 | do_bold(GtkAction *bold, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 | g_return_if_fail(toolbar != NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
158 | pidgin_webview_toggle_bold(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
159 | 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
|
160 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
163 | do_italic(GtkAction *italic, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
165 | g_return_if_fail(toolbar != NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
166 | pidgin_webview_toggle_italic(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
167 | 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
|
168 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
169 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
170 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
171 | do_underline(GtkAction *underline, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
172 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
173 | g_return_if_fail(toolbar != NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
174 | pidgin_webview_toggle_underline(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
175 | 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
|
176 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
178 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
179 | do_strikethrough(GtkAction *strikethrough, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 | g_return_if_fail(toolbar != NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
182 | pidgin_webview_toggle_strike(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 | 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
|
184 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
187 | do_small(GtkAction *small, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 | g_return_if_fail(toolbar != NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
190 | pidgin_webview_font_shrink(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
191 | gtk_widget_grab_focus(toolbar->webview); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
193 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
195 | do_big(GtkAction *large, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 | g_return_if_fail(toolbar); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
198 | pidgin_webview_font_grow(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 | gtk_widget_grab_focus(toolbar->webview); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
200 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
202 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
203 | destroy_toolbar_font(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
205 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
206 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
207 | |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
208 | 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
|
209 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
210 | 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
|
211 | 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
|
212 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
213 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
214 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
215 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
216 | apply_font(GtkDialog *dialog, gint response, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
217 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
218 | /* 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
|
219 | 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
|
220 | gchar *fontname = NULL; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
221 | |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
222 | if (response == GTK_RESPONSE_OK) |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
223 | 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
|
224 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
225 | if (fontname) { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
226 | PangoFontDescription *desc; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
227 | 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
|
228 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
229 | 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
|
230 | 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
|
231 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
232 | if (family_name) { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
233 | pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview), |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
234 | 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
|
235 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
236 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
237 | 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
|
238 | g_free(fontname); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
239 | } else { |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
240 | pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview), |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
241 | PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
242 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
243 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
244 | 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
|
245 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
246 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
247 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
248 | toggle_font(GtkAction *font, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
249 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
250 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
251 | pidgin_webviewtoolbar_get_instance_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
|
252 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
253 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(font))) { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
254 | char *fontname = pidgin_webview_get_current_fontface(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
255 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
256 | if (!priv->font_dialog) { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
257 | GtkWindow *window; |
|
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
258 | 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
|
259 | 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
|
260 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
261 | if (fontname) { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
262 | char *fonttif = g_strdup_printf("%s 12", fontname); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
263 | 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
|
264 | fonttif); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
265 | g_free(fonttif); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
266 | } else { |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
267 | gtk_font_chooser_set_font(GTK_FONT_CHOOSER(priv->font_dialog), |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
268 | PIDGIN_DEFAULT_FONT_FACE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
269 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
270 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
271 | 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
|
272 | G_CALLBACK(apply_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
|
273 | } |
|
32818
d5a17a5c1f29
Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32817
diff
changeset
|
274 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
275 | 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
|
276 | |
|
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
277 | 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
|
278 | } else { |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
279 | pidgin_webview_toggle_fontface(PIDGIN_WEBVIEW(toolbar->webview), |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
280 | PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT); |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
281 | 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
|
282 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
283 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
284 | 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
|
285 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
286 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
287 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
288 | destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
289 | PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
290 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
291 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
292 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
293 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
294 | if (widget != NULL) { |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
295 | pidgin_webview_toggle_forecolor( |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
296 | PIDGIN_WEBVIEW(toolbar->webview), |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
297 | PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FGCOLOR); |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
298 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
299 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
300 | if (priv->fgcolor_dialog != NULL) { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
301 | 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
|
302 | 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
|
303 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
304 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
305 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
306 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
307 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
308 | static void |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
309 | do_fgcolor(GtkDialog *dialog, gint response, gpointer _toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
310 | { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
311 | PidginWebViewToolbar *toolbar = _toolbar; |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
312 | GdkRGBA text_color; |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
313 | gchar *open_tag; |
|
32818
d5a17a5c1f29
Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32817
diff
changeset
|
314 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
315 | if (response != GTK_RESPONSE_OK) { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
316 | destroy_toolbar_fgcolor(GTK_WIDGET(toolbar), NULL, toolbar); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
317 | return; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
318 | } |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
319 | |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
320 | gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(dialog), &text_color); |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
321 | open_tag = pidgin_color_to_str(&text_color); |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
322 | pidgin_webview_toggle_forecolor(PIDGIN_WEBVIEW(toolbar->webview), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
323 | 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
|
324 | 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
|
325 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
326 | destroy_toolbar_fgcolor(NULL, NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
327 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
328 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
329 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
330 | toggle_fg_color(GtkAction *color, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
331 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
332 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
333 | pidgin_webviewtoolbar_get_instance_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
|
334 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
335 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
336 | GdkRGBA fgcolor; |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
337 | gchar *color = pidgin_webview_get_current_forecolor( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
338 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
339 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
340 | if (!priv->fgcolor_dialog) { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
341 | priv->fgcolor_dialog = gtk_color_chooser_dialog_new( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
342 | _("Select Text Color"), GTK_WINDOW( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
343 | gtk_widget_get_ancestor(toolbar->webview, |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
344 | GTK_TYPE_WINDOW))); |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
345 | gtk_color_chooser_set_use_alpha( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
346 | GTK_COLOR_CHOOSER(priv->fgcolor_dialog), FALSE); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
347 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
348 | if (pidgin_color_parse(color, &fgcolor)) { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
349 | gtk_color_chooser_set_rgba( |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
350 | GTK_COLOR_CHOOSER(priv->fgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
351 | &fgcolor); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
352 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
353 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
354 | g_signal_connect(G_OBJECT(priv->fgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
355 | "delete_event", |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
356 | G_CALLBACK(destroy_toolbar_fgcolor), toolbar); |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
357 | |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
358 | g_signal_connect(G_OBJECT(priv->fgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
359 | "response", G_CALLBACK(do_fgcolor), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
360 | } |
|
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
|
361 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
362 | g_free(color); |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
363 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
364 | gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
365 | } else { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
366 | destroy_toolbar_fgcolor(GTK_WIDGET(toolbar), NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
367 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
368 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
369 | 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
|
370 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
371 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
372 | static gboolean |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
373 | destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
374 | PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
375 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
376 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
377 | pidgin_webviewtoolbar_get_instance_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
|
378 | if (widget != NULL) { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
379 | pidgin_webview_toggle_backcolor( |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
380 | PIDGIN_WEBVIEW(toolbar->webview), |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
381 | PIDGIN_WEBVIEWTOOLBAR_DEFAULT_BGCOLOR); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
382 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
383 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
384 | if (priv->bgcolor_dialog != NULL) { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
385 | gtk_widget_destroy(priv->bgcolor_dialog); |
|
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
386 | priv->bgcolor_dialog = NULL; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
387 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
388 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
389 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
390 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
391 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
392 | static void |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
393 | do_bgcolor(GtkDialog *dialog, gint response, gpointer _toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
394 | { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
395 | PidginWebViewToolbar *toolbar = _toolbar; |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
396 | GdkRGBA text_color; |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
397 | gchar *open_tag; |
|
32818
d5a17a5c1f29
Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32817
diff
changeset
|
398 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
399 | if (response != GTK_RESPONSE_OK) { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
400 | destroy_toolbar_bgcolor(GTK_WIDGET(toolbar), NULL, toolbar); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
401 | return; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
402 | } |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
403 | |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
404 | gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(dialog), &text_color); |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
405 | open_tag = pidgin_color_to_str(&text_color); |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
406 | pidgin_webview_toggle_backcolor(PIDGIN_WEBVIEW(toolbar->webview), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
407 | 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
|
408 | 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
|
409 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
410 | destroy_toolbar_bgcolor(NULL, NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
411 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
412 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
413 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
414 | toggle_bg_color(GtkAction *color, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
415 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
416 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
417 | pidgin_webviewtoolbar_get_instance_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
|
418 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
419 | if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
420 | GdkRGBA bgcolor; |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
421 | gchar *color = pidgin_webview_get_current_backcolor( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
422 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
423 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
424 | if (!priv->bgcolor_dialog) { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
425 | priv->bgcolor_dialog = gtk_color_chooser_dialog_new( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
426 | _("Select Background Color"), GTK_WINDOW( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
427 | gtk_widget_get_ancestor(toolbar->webview, |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
428 | GTK_TYPE_WINDOW))); |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
429 | gtk_color_chooser_set_use_alpha( |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
430 | GTK_COLOR_CHOOSER(priv->bgcolor_dialog), FALSE); |
|
33131
c73cb391930b
Copy some GTK+3 changes from the imhtml toolbar to the webview toolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
431 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
432 | if (pidgin_color_parse(color, &bgcolor)) { |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
433 | gtk_color_chooser_set_rgba( |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
434 | GTK_COLOR_CHOOSER(priv->bgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
435 | &bgcolor); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
436 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
437 | |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
438 | g_signal_connect(G_OBJECT(priv->bgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
439 | "delete_event", |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
440 | G_CALLBACK(destroy_toolbar_bgcolor), toolbar); |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
441 | g_signal_connect(G_OBJECT(priv->bgcolor_dialog), |
|
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
442 | "response", G_CALLBACK(do_bgcolor), toolbar); |
|
32818
d5a17a5c1f29
Use the toolbar as the userdat to avoid g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32817
diff
changeset
|
443 | } |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
444 | 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
|
445 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
446 | gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
447 | } else { |
|
35547
561418a41b08
Replace gtk_color_selection with gtk_color_chooser
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35528
diff
changeset
|
448 | destroy_toolbar_bgcolor(GTK_WIDGET(toolbar), NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
449 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
450 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
451 | 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
|
452 | } |
|
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 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
455 | clear_formatting_cb(GtkAction *clear, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
456 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
457 | pidgin_webview_clear_formatting(PIDGIN_WEBVIEW(toolbar->webview)); |
|
33023
35de4c169b1a
This focus grab seems to be in the wrong place.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33019
diff
changeset
|
458 | 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
|
459 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
460 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
461 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
462 | cancel_link_cb(PidginWebViewToolbar *toolbar, PurpleRequestFields *fields) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
463 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
464 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
465 | pidgin_webviewtoolbar_get_instance_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
|
466 | 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
|
467 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
468 | 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 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
470 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
471 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
472 | close_link_dialog(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
473 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
474 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
475 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
476 | 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
|
477 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
478 | 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
|
479 | 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
|
480 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
481 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
482 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
483 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
484 | do_insert_link_cb(PidginWebViewToolbar *toolbar, PurpleRequestFields *fields) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
485 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
486 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
487 | pidgin_webviewtoolbar_get_instance_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
|
488 | 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
|
489 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
490 | url = purple_request_fields_get_string(fields, "url"); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
491 | if (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_LINKDESC) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
492 | 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
|
493 | else |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
494 | description = NULL; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
495 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
496 | pidgin_webview_insert_link(PIDGIN_WEBVIEW(toolbar->webview), url, description); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
497 | |
|
33019
83a3a76bf86d
Fix a widget type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33017
diff
changeset
|
498 | 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
|
499 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
500 | 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
|
501 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
502 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
503 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
504 | insert_link_cb(GtkAction *action, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
505 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
506 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
507 | pidgin_webviewtoolbar_get_instance_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
|
508 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
509 | 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
|
510 | PurpleRequestFields *fields; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
511 | PurpleRequestFieldGroup *group; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
512 | PurpleRequestField *field; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
513 | char *msg; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
514 | 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
|
515 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
516 | 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
|
517 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
518 | 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
|
519 | 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
|
520 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
521 | 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
|
522 | 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
|
523 | 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
|
524 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
525 | if (pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(toolbar->webview)) & PIDGIN_WEBVIEW_LINKDESC) { |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
526 | desc = pidgin_webview_get_selected_text(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
527 | 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
|
528 | desc, FALSE); |
|
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_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
|
530 | 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
|
531 | "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
|
532 | "is optional.")); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
533 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
534 | 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
|
535 | "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
|
536 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
537 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
538 | priv->link_dialog = |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
539 | purple_request_fields(toolbar, _("Insert Link"), NULL, |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
540 | msg, fields, _("_Insert"), |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
541 | G_CALLBACK(do_insert_link_cb), _("Cancel"), |
|
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34308
diff
changeset
|
542 | G_CALLBACK(cancel_link_cb), NULL, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
543 | 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
|
544 | 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
|
545 | } else { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
546 | 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
|
547 | } |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
548 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
549 | 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
|
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 |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
553 | insert_hr_cb(GtkAction *action, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
554 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
555 | pidgin_webview_insert_hr(PIDGIN_WEBVIEW(toolbar->webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
556 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
557 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
558 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
559 | do_insert_image_cb(GtkWidget *widget, int response, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
560 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
561 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
562 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
35830
fb32647ef2f3
PurpleImage: better reference management
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35821
diff
changeset
|
563 | gchar *filename = NULL; |
|
35812
48c6ee645ca1
Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35796
diff
changeset
|
564 | PurpleImage *img; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
565 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
566 | if (response == GTK_RESPONSE_ACCEPT) |
|
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
567 | 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
|
568 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
569 | /* 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
|
570 | 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
|
571 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
572 | 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
|
573 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
574 | |
|
38285
72824d3b7190
Update pidgin for the PurpleImage and PurpleSmiley changes
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
575 | img = purple_image_new_from_file(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
|
576 | |
|
35812
48c6ee645ca1
Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35796
diff
changeset
|
577 | if (!img) { |
|
35830
fb32647ef2f3
PurpleImage: better reference management
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35821
diff
changeset
|
578 | gchar *buf = g_strdup_printf(_("Failed to store image: %s"), |
|
fb32647ef2f3
PurpleImage: better reference management
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35821
diff
changeset
|
579 | filename); |
|
fb32647ef2f3
PurpleImage: better reference management
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35821
diff
changeset
|
580 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
581 | purple_notify_error(NULL, NULL, buf, NULL, NULL); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
582 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
583 | 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
|
584 | 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
|
585 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
586 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
587 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
588 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
589 | 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 | |
|
35812
48c6ee645ca1
Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35796
diff
changeset
|
591 | pidgin_webview_insert_image(PIDGIN_WEBVIEW(toolbar->webview), img); |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36633
diff
changeset
|
592 | /* TODO: do it after passing an image to protocol, not before |
|
35812
48c6ee645ca1
Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35796
diff
changeset
|
593 | * g_object_unref(img); |
|
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
|
594 | */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
595 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
596 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
597 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
598 | insert_image_cb(GtkAction *action, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
599 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
600 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
601 | pidgin_webviewtoolbar_get_instance_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
|
602 | GtkWidget *window; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
603 | |
|
33017
d21ab88ad911
Fixup Insert Image functionality.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33015
diff
changeset
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | NULL); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
610 | 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
|
611 | 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
|
612 | 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
|
613 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
614 | 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
|
615 | 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
|
616 | } else { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
617 | 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
|
618 | 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
|
619 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
620 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
621 | 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
|
622 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
623 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
624 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
625 | destroy_smiley_dialog(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
626 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
627 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
628 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
629 | 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
|
630 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
631 | 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
|
632 | 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 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
634 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
635 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
636 | static gboolean |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
637 | close_smiley_dialog(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
638 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
639 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
640 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
33266
2188505ba110
Re-enable the Smile! window on the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33255
diff
changeset
|
641 | 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
|
642 | return FALSE; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
643 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
644 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
645 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
646 | insert_smiley_text(GtkWidget *widget, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
647 | { |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
648 | PurpleSmiley *smiley; |
|
35815
d6fe2c2ebbbe
imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
649 | guint image_id; |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
650 | gchar *escaped_smiley, *smiley_html; |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
651 | const gchar *smiley_class; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
652 | |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
653 | smiley = g_object_get_data(G_OBJECT(widget), "smiley"); |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
654 | smiley_class = g_object_get_data(G_OBJECT(widget), "smiley-class"); |
|
38285
72824d3b7190
Update pidgin for the PurpleImage and PurpleSmiley changes
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
655 | image_id = purple_image_store_add(PURPLE_IMAGE(smiley)); |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
656 | |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
657 | escaped_smiley = g_markup_escape_text( |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
658 | purple_smiley_get_shortcut(smiley), -1); |
|
35815
d6fe2c2ebbbe
imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
659 | smiley_html = g_strdup_printf("<img src=\"" PURPLE_IMAGE_STORE_PROTOCOL |
|
d6fe2c2ebbbe
imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35812
diff
changeset
|
660 | "%u\" class=\"emoticon %s-emoticon\" alt=\"%s\" title=\"%s\">", |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
661 | image_id, smiley_class, escaped_smiley, escaped_smiley); |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
662 | |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
663 | g_free(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
|
664 | |
|
35714
bb2c91c3e2db
Drop PidginWebViewSmiley
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35713
diff
changeset
|
665 | pidgin_webview_append_html(PIDGIN_WEBVIEW(toolbar->webview), |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
666 | smiley_html); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
667 | |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
668 | g_free(smiley_html); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
669 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
670 | 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
|
671 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
672 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
673 | static gboolean |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
674 | smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
675 | PidginWebViewToolbar *toolbar) |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
676 | { |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
677 | if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || |
|
38712
ea49cd76cf47
Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38708
diff
changeset
|
678 | (event->type == GDK_BUTTON_PRESS && event->button.button == GDK_BUTTON_PRIMARY)) |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
679 | { |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
680 | close_smiley_dialog(toolbar); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
681 | return TRUE; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
682 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
683 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
684 | return FALSE; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
685 | } |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
686 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
687 | /* returns: total width */ |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
688 | static gulong |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
689 | smileys_load_button_thumbs(GList *smileys) |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
690 | { |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
691 | GList *it; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
692 | gulong total_width = 0; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
693 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
694 | for (it = smileys; it; it = g_list_next(it)) { |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
695 | PurpleSmiley *smiley = it->data; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
696 | GdkPixbuf *pixbuf; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
697 | guint width; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
698 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
699 | width = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(smiley), |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
700 | "pidgin-webviewtoolbar-button-width")); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
701 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
702 | /* smiley is already loaded */ |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
703 | if (width > 0) { |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
704 | total_width += width; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
705 | continue; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
706 | } |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
707 | |
|
38285
72824d3b7190
Update pidgin for the PurpleImage and PurpleSmiley changes
Gary Kramlich <grim@reaperworld.com>
parents:
38277
diff
changeset
|
708 | pixbuf = pidgin_pixbuf_from_image(PURPLE_IMAGE(smiley)); |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
709 | pixbuf = pidgin_pixbuf_scale_down(pixbuf, |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
710 | 24, 24, GDK_INTERP_BILINEAR, TRUE); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
711 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
712 | if (pixbuf) |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
713 | width = gdk_pixbuf_get_width(pixbuf); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
714 | if (width == 0) |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
715 | width = 1; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
716 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
717 | /* XXX: a padding for the button */ |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
718 | width += 12; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
719 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
720 | g_object_set_data(G_OBJECT(smiley), |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
721 | "pidgin-webviewtoolbar-button-width", |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
722 | GINT_TO_POINTER(width)); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
723 | g_object_set_data_full(G_OBJECT(smiley), |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
724 | "pidgin-webviewtoolbar-button-image", |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
725 | pixbuf, g_object_unref); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
726 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
727 | total_width += width; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
728 | } |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
729 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
730 | return total_width; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
731 | } |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
732 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
733 | static void |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
734 | add_smiley_list(PidginWebViewToolbar *toolbar, GtkWidget *container, |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
735 | GList *smileys, int max_width, PurpleSmileyList *shadow_smileys, |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
736 | const gchar *smiley_class) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
737 | { |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
738 | GList *it; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
739 | GtkWidget *line; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
740 | int line_width = 0; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
741 | |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
742 | if (!smileys) |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
743 | return; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
744 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
745 | /* TODO: sort smileys by their position in theme */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
746 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
747 | line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
748 | gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
749 | for (it = smileys; it; it = g_list_next(it)) { |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
750 | PurpleSmiley *smiley = it->data; |
|
35741
cc902e300176
Smileys toolbar: scale down big smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35740
diff
changeset
|
751 | GtkWidget *button; |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
752 | GdkPixbuf *pixbuf; |
|
35741
cc902e300176
Smileys toolbar: scale down big smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35740
diff
changeset
|
753 | GtkImage *image; |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
754 | guint width; |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
755 | const gchar *smiley_shortcut; |
|
35741
cc902e300176
Smileys toolbar: scale down big smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35740
diff
changeset
|
756 | |
|
35769
00e61752e21c
Fix build and warnings after merge
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35743
diff
changeset
|
757 | smiley_shortcut = purple_smiley_get_shortcut(smiley); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
758 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
759 | width = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(smiley), |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
760 | "pidgin-webviewtoolbar-button-width")); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
761 | pixbuf = g_object_get_data(G_OBJECT(smiley), |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
762 | "pidgin-webviewtoolbar-button-image"); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
763 | if (!pixbuf) { |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
764 | purple_debug_warning("gtkwebviewtoolbar", "Smiley does " |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
765 | "not exists: %s", smiley_shortcut); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
766 | continue; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
767 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
768 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
769 | image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
770 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
771 | button = gtk_button_new(); |
|
35741
cc902e300176
Smileys toolbar: scale down big smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35740
diff
changeset
|
772 | gtk_container_add(GTK_CONTAINER(button), GTK_WIDGET(image)); |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
773 | |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
774 | g_object_ref(smiley); |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
775 | g_object_set_data_full(G_OBJECT(button), "smiley", |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
776 | smiley, g_object_unref); |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
777 | g_object_set_data(G_OBJECT(button), |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
778 | "smiley-class", (gpointer)smiley_class); |
|
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
779 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
780 | g_signal_connect(G_OBJECT(button), "clicked", |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
781 | G_CALLBACK(insert_smiley_text), toolbar); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
782 | gtk_widget_set_tooltip_text(button, smiley_shortcut); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
783 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
784 | |
|
35740
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
785 | /* Disable theme smileys shadowed by custom smileys. |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
786 | * There is a case, when a theme smiley have another, |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
787 | * non-shadowed shortcut. But we won't handle it. |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
788 | */ |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
789 | if (shadow_smileys && purple_smiley_list_get_by_shortcut( |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
790 | shadow_smileys, smiley_shortcut)) |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
791 | { |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
792 | gchar tip[1000]; |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
793 | g_snprintf(tip, sizeof(tip), _("This smiley is " |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
794 | "disabled because a custom smiley exists for " |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
795 | "this shortcut:\n %s"), smiley_shortcut); |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
796 | gtk_widget_set_tooltip_text(button, tip); |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
797 | gtk_widget_set_sensitive(button, FALSE); |
|
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
798 | } |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
799 | |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
800 | gtk_box_pack_start(GTK_BOX(line), button, FALSE, FALSE, 0); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
801 | gtk_widget_show(button); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
802 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
803 | line_width += width; |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
804 | if (line_width >= max_width && g_list_next(it)) { |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
805 | line_width = 0; |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
806 | line = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
807 | gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
|
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
808 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
809 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
810 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
811 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
812 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
813 | static void |
|
35743
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
814 | insert_smiley_manage_cb(GtkButton *button, gpointer _dialog) |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
815 | { |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
816 | GtkWidget *dialog = _dialog; |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
817 | |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
818 | gtk_widget_destroy(dialog); |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
819 | pidgin_smiley_manager_show(); |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
820 | } |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
821 | |
|
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
822 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
823 | insert_smiley_cb(GtkAction *smiley, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
824 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
825 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
826 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
827 | PurpleSmileyList *smileys_from_theme, *smileys_from_custom = NULL; |
|
35739
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
828 | GList *theme_smileys = NULL, *custom_smileys = NULL, *it, *it_next; |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
829 | PidginWebViewButtons webview_format; |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
830 | |
|
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 | 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
|
834 | GtkRequisition req; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
835 | 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
|
836 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
837 | 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
|
838 | 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
|
839 | 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
|
840 | return; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
841 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
842 | |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
843 | webview_format = pidgin_webview_get_format_functions( |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
844 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
845 | |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
846 | smileys_from_theme = pidgin_smiley_theme_for_conv(priv->active_conv); |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
847 | if (smileys_from_theme) { |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
848 | theme_smileys = purple_smiley_list_get_unique( |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
849 | smileys_from_theme); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
850 | } |
|
35739
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
851 | |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
852 | /* remove hidden theme smileys */ |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
853 | for (it = theme_smileys; it; it = it_next) { |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
854 | PurpleSmiley *smiley = it->data; |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
855 | it_next = g_list_next(it); |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
856 | |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
857 | if (!g_object_get_data(G_OBJECT(smiley), |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
858 | "pidgin-smiley-hidden")) |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
859 | { |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
860 | continue; |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
861 | } |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
862 | |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
863 | theme_smileys = g_list_delete_link(theme_smileys, it); |
|
cb9acfd6fa1e
Smileys: hide hidden smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35738
diff
changeset
|
864 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
865 | |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
866 | supports_custom = (webview_format & PIDGIN_WEBVIEW_CUSTOM_SMILEY); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
867 | if (supports_custom) { |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
868 | smileys_from_custom = purple_smiley_custom_get_list(); |
|
35728
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35718
diff
changeset
|
869 | custom_smileys = purple_smiley_list_get_all( |
|
6cd9aee7f276
Smiley manager: edit, delete
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35718
diff
changeset
|
870 | smileys_from_custom); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
871 | } |
|
32806
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 | 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
|
874 | gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
875 | vbox = pidgin_dialog_get_vbox_with_properties( |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
876 | GTK_DIALOG(dialog), FALSE, 0); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
877 | |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
878 | if (theme_smileys != NULL || custom_smileys != NULL) { |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
879 | guint max_line_width, num_lines, button_width = 0; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
880 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
881 | /* Fill the cache (images and their widths). */ |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
882 | max_line_width = smileys_load_button_thumbs(theme_smileys); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
883 | max_line_width += smileys_load_button_thumbs(custom_smileys); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
884 | num_lines = sqrt(g_list_length(theme_smileys) + |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
885 | g_list_length(custom_smileys)); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
886 | max_line_width /= num_lines; |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
887 | |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
888 | /* We use hboxes packed in a vbox. */ |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35506
diff
changeset
|
889 | smiley_table = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
890 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
891 | /* Custom smileys manager button. */ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
892 | if (supports_custom) { |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
893 | GtkWidget *manage = gtk_button_new_with_mnemonic( |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
894 | _("_Manage custom smileys")); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
895 | GtkRequisition req; |
|
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(G_OBJECT(manage), "clicked", |
|
35743
3fc93e539e20
Smiley toolbar: fix focus issues when opening manager window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35742
diff
changeset
|
897 | G_CALLBACK(insert_smiley_manage_cb), dialog); |
|
32806
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; |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
901 | max_line_width = MAX(button_width, max_line_width); |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
902 | } else { |
|
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
903 | max_line_width = MAX(max_line_width, 100); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
904 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
905 | |
|
35742
3585fead43a8
Smiley toolbar: cache thumbnails
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35741
diff
changeset
|
906 | /* Add buttons for smileys. */ |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
907 | if (theme_smileys) { |
|
35740
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
908 | add_smiley_list(toolbar, smiley_table, theme_smileys, |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
909 | max_line_width, smileys_from_custom, "theme"); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
910 | } |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
911 | if (theme_smileys && custom_smileys) { |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
912 | gtk_box_pack_start(GTK_BOX(smiley_table), |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
913 | gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
914 | TRUE, FALSE, 0); |
|
35717
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
915 | } |
|
45bde03f86a6
Custom smileys: simplify storage implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35716
diff
changeset
|
916 | if (custom_smileys) { |
|
35740
b7962ff7748d
Smiley toolbar: disable shadowed smileys
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35739
diff
changeset
|
917 | add_smiley_list(toolbar, smiley_table, custom_smileys, |
|
35796
bc5253318167
Show smiley images in the input entry and fix some smiley and inline image issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35771
diff
changeset
|
918 | max_line_width, NULL, "custom"); |
|
32806
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 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
921 | gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); |
|
35713
4423f463a782
Smileys in PidginWebviewToolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35710
diff
changeset
|
922 | } else { |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
923 | 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
|
924 | 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
|
925 | 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
|
926 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
927 | |
|
35716
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
928 | g_list_free(theme_smileys); |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
929 | g_list_free(custom_smileys); |
|
80bedd712883
Custom smileys: parse and display in toolbar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35714
diff
changeset
|
930 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
931 | 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
|
932 | 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
|
933 | 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
|
934 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
935 | 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
|
936 | 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
|
937 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
938 | /* connect signals */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
939 | 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
|
940 | 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
|
941 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
942 | 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
|
943 | 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
|
944 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
945 | /* show everything */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
946 | 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
|
947 | |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33276
diff
changeset
|
948 | 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
|
949 | 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
|
950 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
951 | /* 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
|
952 | * 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
|
953 | * 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
|
954 | * 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
|
955 | * 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
|
956 | 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
|
957 | 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
|
958 | "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
|
959 | "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
|
960 | NULL); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
961 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
962 | #ifdef _WIN32 |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
963 | 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
|
964 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
965 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
966 | 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
|
967 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
968 | 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
|
969 | } |
|
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 | static void |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
972 | update_smiley_button(PidginWebViewToolbar *toolbar) |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
973 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
974 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
975 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
976 | PurpleSmileyList *sl; |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
977 | gboolean any_smileys; |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
978 | PidginWebViewButtons webview_format = 0; |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
979 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
980 | g_return_if_fail(priv != NULL); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
981 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
982 | if (toolbar->webview) { |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
983 | webview_format = pidgin_webview_get_format_functions( |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
984 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
985 | } |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
986 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
987 | if (!priv->allow_smileys) { |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
988 | gtk_action_set_sensitive(priv->smiley, FALSE); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
989 | return; |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
990 | } |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
991 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
992 | sl = pidgin_smiley_theme_for_conv(priv->active_conv); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
993 | /* it's possible, that all theme smileys are hidden, |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
994 | * but we won't handle it */ |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
995 | any_smileys = (sl ? !purple_smiley_list_is_empty(sl) : FALSE); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
996 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
997 | if (!any_smileys && (webview_format & PIDGIN_WEBVIEW_CUSTOM_SMILEY)) { |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
998 | sl = purple_smiley_custom_get_list(); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
999 | any_smileys = (sl ? !purple_smiley_list_is_empty(sl) : FALSE); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1000 | } |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1001 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1002 | gtk_action_set_sensitive(priv->smiley, any_smileys); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1003 | } |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1004 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1005 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1006 | send_attention_cb(GtkAction *attention, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1007 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1008 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1009 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32819
9d3b96bd2923
Use pointers in the private struct instead of g_object_[gs]et_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32818
diff
changeset
|
1010 | 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
|
1011 | 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
|
1012 | 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
|
1013 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1014 | purple_protocol_send_attention(gc, who, 0); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1015 | 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
|
1016 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1017 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1018 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1019 | update_buttons_cb(PidginWebView *webview, PidginWebViewButtons buttons, |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1020 | PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1021 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1022 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1023 | pidgin_webviewtoolbar_get_instance_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
|
1024 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1025 | gtk_action_set_sensitive(priv->bold, buttons & PIDGIN_WEBVIEW_BOLD); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1026 | gtk_action_set_sensitive(priv->italic, buttons & PIDGIN_WEBVIEW_ITALIC); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1027 | gtk_action_set_sensitive(priv->underline, buttons & PIDGIN_WEBVIEW_UNDERLINE); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1028 | gtk_action_set_sensitive(priv->strike, buttons & PIDGIN_WEBVIEW_STRIKE); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1029 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1030 | gtk_action_set_sensitive(priv->larger_size, buttons & PIDGIN_WEBVIEW_GROW); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1031 | gtk_action_set_sensitive(priv->smaller_size, buttons & PIDGIN_WEBVIEW_SHRINK); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1032 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1033 | gtk_action_set_sensitive(priv->font, buttons & PIDGIN_WEBVIEW_FACE); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1034 | gtk_action_set_sensitive(priv->fgcolor, buttons & PIDGIN_WEBVIEW_FORECOLOR); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1035 | gtk_action_set_sensitive(priv->bgcolor, buttons & PIDGIN_WEBVIEW_BACKCOLOR); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1036 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1037 | gtk_action_set_sensitive(priv->clear, |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1038 | (buttons & PIDGIN_WEBVIEW_BOLD || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1039 | buttons & PIDGIN_WEBVIEW_ITALIC || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1040 | buttons & PIDGIN_WEBVIEW_UNDERLINE || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1041 | buttons & PIDGIN_WEBVIEW_STRIKE || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1042 | buttons & PIDGIN_WEBVIEW_GROW || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1043 | buttons & PIDGIN_WEBVIEW_SHRINK || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1044 | buttons & PIDGIN_WEBVIEW_FACE || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1045 | buttons & PIDGIN_WEBVIEW_FORECOLOR || |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1046 | buttons & PIDGIN_WEBVIEW_BACKCOLOR)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1047 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1048 | gtk_action_set_sensitive(priv->image, buttons & PIDGIN_WEBVIEW_IMAGE); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1049 | gtk_action_set_sensitive(priv->link, buttons & PIDGIN_WEBVIEW_LINK); |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1050 | |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1051 | priv->allow_smileys = !!(buttons & PIDGIN_WEBVIEW_SMILEY); |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1052 | update_smiley_button(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1053 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1054 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1055 | /* 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
|
1056 | * 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
|
1057 | * 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
|
1058 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1059 | static void |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1060 | toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1061 | PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1062 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1063 | GObject *object; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1064 | 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
|
1065 | |
|
39274
7acdb1d9797c
pidgin: Fix various -Wincompatible-pointer-types warnings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39238
diff
changeset
|
1066 | object = g_object_ref(G_OBJECT(action)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1067 | 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
|
1068 | 0, 0, NULL, NULL, toolbar); |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1069 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1070 | 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
|
1071 | 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
|
1072 | 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
|
1073 | 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
|
1074 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1075 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1076 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1077 | update_buttons(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1078 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1079 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1080 | pidgin_webviewtoolbar_get_instance_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
|
1081 | gboolean bold, italic, underline, strike; |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1082 | char *tmp, *color_str; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1083 | char *label; |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
1084 | GdkRGBA color; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1085 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1086 | 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
|
1087 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1088 | pidgin_webview_get_current_format(PIDGIN_WEBVIEW(toolbar->webview), |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1089 | &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
|
1090 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1091 | 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
|
1092 | 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
|
1093 | toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1094 | 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
|
1095 | 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
|
1096 | toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1097 | 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
|
1098 | 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
|
1099 | underline, toolbar); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1100 | 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
|
1101 | 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
|
1102 | toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1103 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1104 | 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
|
1105 | 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
|
1106 | 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
|
1107 | 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
|
1108 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1109 | 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
|
1110 | 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
|
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 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1114 | 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
|
1115 | 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
|
1116 | 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
|
1117 | 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
|
1118 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1119 | 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
|
1120 | 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
|
1121 | 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
|
1122 | 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
|
1123 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1124 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1125 | tmp = pidgin_webview_get_current_fontface(PIDGIN_WEBVIEW(toolbar->webview)); |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1126 | if (tmp && tmp[0] == '\0') |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1127 | tmp = NULL; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1128 | if (g_strcmp0(tmp, PIDGIN_WEBVIEWTOOLBAR_DEFAULT_FONT) == 0) |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1129 | tmp = NULL; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1130 | 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
|
1131 | (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
|
1132 | if (tmp && *tmp) { |
|
35126
669cb2286130
Remove "'fontdesc' attribute not allowed in <span>" warnings
Ankit Vani <a@nevitus.org>
parents:
35094
diff
changeset
|
1133 | gchar *markup = g_strdup_printf("<span face=\"%s\">%s</span>", |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1134 | tmp, label); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1135 | 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
|
1136 | 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
|
1137 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1138 | 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
|
1139 | |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1140 | tmp = pidgin_webview_get_current_forecolor( |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1141 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1142 | color_str = NULL; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1143 | if (pidgin_color_parse(tmp, &color) && |
|
37992
0185eb26ac7d
Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37991
diff
changeset
|
1144 | (color.red > 0 || color.green > 0 || color.blue > 0)) |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1145 | { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1146 | color_str = pidgin_color_to_str(&color); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1147 | } |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1148 | g_free(tmp); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1149 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1150 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->fgcolor), |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1151 | color_str != NULL, toolbar); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1152 | if (color_str) { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1153 | gchar *markup = g_strdup_printf( |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1154 | "<span foreground=\"%s\">%s</span>", color_str, label); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1155 | 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
|
1156 | 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
|
1157 | } |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1158 | g_free(color_str); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1159 | |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1160 | tmp = pidgin_webview_get_current_backcolor( |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1161 | PIDGIN_WEBVIEW(toolbar->webview)); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1162 | color_str = NULL; |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1163 | if (pidgin_color_parse(tmp, &color)) |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1164 | { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1165 | color_str = pidgin_color_to_str(&color); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1166 | } |
|
32895
fbd3b11e535a
WebKit knows the current formatting of the selection better than we
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32820
diff
changeset
|
1167 | 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
|
1168 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1169 | toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bgcolor), |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1170 | color_str != NULL, toolbar); |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1171 | if (color_str) { |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1172 | gchar *markup = g_strdup_printf( |
|
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1173 | "<span background=\"%s\">%s</span>", color_str, label); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1174 | 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
|
1175 | 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
|
1176 | } |
|
35552
0497dd67473c
Fix most (all?) of webviewtoolbar issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35547
diff
changeset
|
1177 | g_free(color_str); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1178 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1179 | 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
|
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 |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1183 | toggle_button_cb(PidginWebView *webview, PidginWebViewButtons buttons, |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1184 | PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1185 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1186 | 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
|
1187 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1188 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1189 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1190 | update_format_cb(PidginWebView *webview, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1191 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1192 | 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
|
1193 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1194 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1195 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1196 | mark_set_cb(PidginWebView *webview, PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1197 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1198 | 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
|
1199 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1200 | |
|
38708
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1201 | #if GTK_CHECK_VERSION(3,22,0) |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1202 | |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1203 | static void |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1204 | pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu) |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1205 | { |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1206 | if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(button))) { |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1207 | gtk_widget_show_all(GTK_WIDGET(menu)); |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1208 | gtk_menu_popup_at_widget(menu, button, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1209 | } |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1210 | } |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1211 | |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1212 | #else /* GTK+ 3.22.0 */ |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1213 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1214 | /* 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
|
1215 | * 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
|
1216 | * 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
|
1217 | */ |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1218 | 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
|
1219 | 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
|
1220 | int *x, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1221 | int *y, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1222 | 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
|
1223 | 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
|
1224 | { |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1225 | GtkWidget *widget = GTK_WIDGET(data); |
|
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
|
1226 | GtkAllocation allocation; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1227 | int savy; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1228 | |
|
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
|
1229 | gtk_widget_get_allocation(widget, &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
|
1230 | 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
|
1231 | *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
|
1232 | *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
|
1233 | savy = *y; |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1234 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1235 | 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
|
1236 | |
|
38169
adcb9a4cc920
gtkutils: remove usage of deprecated xthickness and ythickness
Jakub Adam <jakub.adam@ktknet.cz>
parents:
38168
diff
changeset
|
1237 | if (savy > *y + 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
|
1238 | *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
|
1239 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1240 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1241 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1242 | 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
|
1243 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1244 | 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
|
1245 | 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
|
1246 | 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
|
1247 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1248 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1249 | |
|
38708
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1250 | #endif /* GTK+ 3.22.0 */ |
|
a65157d76fee
Use gtk_menu_popup_at_widget instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
1251 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1252 | static void |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1253 | 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
|
1254 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1255 | 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
|
1256 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1257 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1258 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1259 | switch_toolbar_view(GtkWidget *item, PidginWebViewToolbar *toolbar) |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1260 | { |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1261 | 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
|
1262 | !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
|
1263 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1264 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1265 | static gboolean |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1266 | pidgin_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1267 | PidginWebViewToolbar *toolbar) |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1268 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1269 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1270 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1271 | GtkWidget *menu; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1272 | GtkWidget *item; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1273 | gboolean wide; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1274 | |
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38299
diff
changeset
|
1275 | if (!gdk_event_triggers_context_menu((GdkEvent *)event)) |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1276 | return FALSE; |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1277 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1278 | 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
|
1279 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1280 | menu = gtk_menu_new(); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1281 | 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
|
1282 | 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
|
1283 | 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
|
1284 | gtk_widget_show(item); |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1285 | |
|
38707
6f4d3ab2f2ed
Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
1286 | gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1287 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1288 | return TRUE; |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1289 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1290 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1291 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1292 | enable_markup(GtkWidget *widget, gpointer null) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1293 | { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1294 | GtkWidget *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1295 | 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
|
1296 | 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
|
1297 | 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
|
1298 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1299 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1300 | static void |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1301 | 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
|
1302 | gconstpointer value, gpointer toolbar) |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1303 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1304 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1305 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1306 | 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
|
1307 | 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
|
1308 | 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
|
1309 | } 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
|
1310 | 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
|
1311 | 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
|
1312 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1313 | } |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1314 | |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1315 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1316 | * GObject stuff |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1317 | *****************************************************************************/ |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1318 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1319 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1320 | pidgin_webviewtoolbar_finalize(GObject *object) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1321 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1322 | PidginWebViewToolbar *toolbar = PIDGIN_WEBVIEWTOOLBAR(object); |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1323 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1324 | pidgin_webviewtoolbar_get_instance_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
|
1325 | |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1326 | 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
|
1327 | { |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1328 | 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
|
1329 | 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
|
1330 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1331 | |
|
33275
8da9d2ec671d
Use new GtkFontChooser where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33266
diff
changeset
|
1332 | 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
|
1333 | 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
|
1334 | 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
|
1335 | 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
|
1336 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1337 | 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
|
1338 | 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
|
1339 | 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
|
1340 | 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
|
1341 | 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
|
1342 | 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
|
1343 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1344 | #if 0 |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1345 | g_signal_handlers_disconnect_matched(PIDGIN_WEBVIEW(toolbar->webview)->text_buffer, |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1346 | G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1347 | toolbar); |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1348 | #endif |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1349 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1350 | |
|
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
|
1351 | 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
|
1352 | 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
|
1353 | 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
|
1354 | 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
|
1355 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1356 | 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
|
1357 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1358 | G_OBJECT_CLASS(pidgin_webviewtoolbar_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
|
1359 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1360 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1361 | static void |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1362 | pidgin_webviewtoolbar_class_init(PidginWebViewToolbarClass *klass) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1363 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1364 | G_OBJECT_CLASS(klass)->finalize = pidgin_webviewtoolbar_finalize; |
|
32817
016056e052ef
Move all internal toolbar pointers into a private struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32815
diff
changeset
|
1365 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1366 | 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
|
1367 | 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
|
1368 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1369 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1370 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1371 | pidgin_webviewtoolbar_create_actions(PidginWebViewToolbar *toolbar) |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1372 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1373 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1374 | pidgin_webviewtoolbar_get_instance_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
|
1375 | GtkActionGroup *action_group; |
|
34308
cdb187c27360
Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34298
diff
changeset
|
1376 | gsize i; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1377 | struct { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1378 | GtkAction **action; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1379 | char *name; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1380 | char *stock; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1381 | char *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1382 | char *tooltip; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1383 | void (*cb)(); |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1384 | gboolean toggle; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1385 | } actions[] = { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1386 | {&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
|
1387 | {&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
|
1388 | {&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
|
1389 | {&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
|
1390 | {&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
|
1391 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1392 | {&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
|
1393 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1394 | {&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
|
1395 | {&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
|
1396 | {&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
|
1397 | {&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
|
1398 | {&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
|
1399 | {&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
|
1400 | {&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
|
1401 | {&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
|
1402 | {&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
|
1403 | {&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
|
1404 | }; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1405 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1406 | action_group = gtk_action_group_new("PidginWebViewToolbar"); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1407 | 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
|
1408 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1409 | 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
|
1410 | GtkAction *action; |
|
34281
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1411 | if (actions[i].toggle) { |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1412 | 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
|
1413 | actions[i].name, _(actions[i].label), |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1414 | _(actions[i].tooltip), actions[i].stock)); |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1415 | } else { |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1416 | 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
|
1417 | _(actions[i].label), _(actions[i].tooltip), |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1418 | actions[i].stock); |
|
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34274
diff
changeset
|
1419 | } |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1420 | 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
|
1421 | 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
|
1422 | 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
|
1423 | *(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
|
1424 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1425 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1426 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1427 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1428 | pidgin_webviewtoolbar_create_wide_view(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1429 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1430 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1431 | pidgin_webviewtoolbar_get_instance_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
|
1432 | GtkAction *layout[] = { |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1433 | priv->bold, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1434 | priv->italic, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1435 | priv->underline, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1436 | priv->strike, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1437 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1438 | 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
|
1439 | #if 0 |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1440 | 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
|
1441 | #endif |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1442 | 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
|
1443 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1444 | priv->font, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1445 | priv->fgcolor, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1446 | priv->bgcolor, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1447 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1448 | priv->clear, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1449 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1450 | priv->image, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1451 | priv->link, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1452 | NULL, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1453 | priv->smiley, |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1454 | 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
|
1455 | }; |
|
34308
cdb187c27360
Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34298
diff
changeset
|
1456 | gsize i; |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1457 | GtkToolItem *item; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1458 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1459 | 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
|
1460 | 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
|
1461 | 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
|
1462 | 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
|
1463 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1464 | for (i = 0; i < G_N_ELEMENTS(layout); i++) { |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1465 | if (layout[i]) { |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1466 | item = GTK_TOOL_ITEM(gtk_action_create_tool_item(layout[i])); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1467 | g_object_set_data(G_OBJECT(item), "action", layout[i]); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1468 | } else |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1469 | 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
|
1470 | 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
|
1471 | } |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1472 | } |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1473 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1474 | static inline void |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1475 | lean_view_add_menu_item(GtkWidget *menu, GtkAction *action) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1476 | { |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1477 | GtkWidget *menuitem; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1478 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1479 | menuitem = gtk_action_create_menu_item(action); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1480 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1481 | g_object_set_data(G_OBJECT(menuitem), "action", action); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1482 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1483 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1484 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1485 | pidgin_webviewtoolbar_create_lean_view(PidginWebViewToolbar *toolbar) |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1486 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1487 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1488 | pidgin_webviewtoolbar_get_instance_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
|
1489 | GtkWidget *label; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1490 | GtkToolItem *sep; |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1491 | 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
|
1492 | 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
|
1493 | 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
|
1494 | 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
|
1495 | 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
|
1496 | 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
|
1497 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1498 | 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
|
1499 | 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
|
1500 | 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
|
1501 | 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
|
1502 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1503 | /* Fonts */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1504 | font_button = gtk_toggle_tool_button_new(); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1505 | g_object_set_data_full(G_OBJECT(font_button), "menu-name", |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1506 | g_strdup("font"), g_free); |
|
33015
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), 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
|
1508 | 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
|
1509 | 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
|
1510 | 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
|
1511 | 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
|
1512 | 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
|
1513 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1514 | priv->font_menu = font_menu = gtk_menu_new(); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1515 | g_object_set_data(G_OBJECT(font_button), "menu", font_menu); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1516 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1517 | lean_view_add_menu_item(font_menu, priv->bold); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1518 | lean_view_add_menu_item(font_menu, priv->italic); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1519 | lean_view_add_menu_item(font_menu, priv->underline); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1520 | lean_view_add_menu_item(font_menu, priv->strike); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1521 | lean_view_add_menu_item(font_menu, priv->larger_size); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1522 | #if 0 |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1523 | lean_view_add_menu_item(font_menu, priv->normal_size); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1524 | #endif |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1525 | lean_view_add_menu_item(font_menu, priv->smaller_size); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1526 | lean_view_add_menu_item(font_menu, priv->font); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1527 | lean_view_add_menu_item(font_menu, priv->fgcolor); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1528 | lean_view_add_menu_item(font_menu, priv->bgcolor); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1529 | lean_view_add_menu_item(font_menu, priv->clear); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1530 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1531 | 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
|
1532 | 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
|
1533 | 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
|
1534 | 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
|
1535 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1536 | 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
|
1537 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1538 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1539 | 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
|
1540 | 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
|
1541 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1542 | /* Insert */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1543 | insert_button = gtk_toggle_tool_button_new(); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1544 | g_object_set_data_full(G_OBJECT(insert_button), "menu-name", |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1545 | g_strdup("insert"), g_free); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1546 | 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
|
1547 | 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
|
1548 | 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
|
1549 | 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
|
1550 | 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
|
1551 | 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
|
1552 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1553 | priv->insert_menu = insert_menu = gtk_menu_new(); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1554 | g_object_set_data(G_OBJECT(insert_button), "menu", 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
|
1555 | |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1556 | lean_view_add_menu_item(insert_menu, priv->image); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1557 | lean_view_add_menu_item(insert_menu, priv->link); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1558 | lean_view_add_menu_item(insert_menu, priv->hr); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1559 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1560 | 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
|
1561 | 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
|
1562 | 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
|
1563 | 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
|
1564 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1565 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1566 | 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
|
1567 | 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
|
1568 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1569 | /* Smiley */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1570 | smiley_button = gtk_action_create_tool_item(priv->smiley); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1571 | g_object_set_data(G_OBJECT(smiley_button), "action", priv->smiley); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1572 | 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
|
1573 | 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
|
1574 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1575 | /* Sep */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1576 | 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
|
1577 | 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
|
1578 | |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1579 | /* Attention */ |
|
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1580 | attention_button = gtk_action_create_tool_item(priv->attention); |
|
35947
0c93751c7c96
scrncap: reference actions, not their names
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35935
diff
changeset
|
1581 | g_object_set_data(G_OBJECT(attention_button), "action", priv->attention); |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1582 | 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
|
1583 | GTK_TOOL_ITEM(attention_button), -1); |
|
32806
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 | static void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1587 | pidgin_webviewtoolbar_init(PidginWebViewToolbar *toolbar) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1588 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1589 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1590 | pidgin_webviewtoolbar_get_instance_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
|
1591 | 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
|
1592 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1593 | pidgin_webviewtoolbar_create_actions(toolbar); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1594 | pidgin_webviewtoolbar_create_wide_view(toolbar); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1595 | pidgin_webviewtoolbar_create_lean_view(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1596 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1597 | 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
|
1598 | 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
|
1599 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1600 | /* 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
|
1601 | 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
|
1602 | |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1603 | priv->allow_smileys = TRUE; |
|
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1604 | update_smiley_button(toolbar); |
|
34283
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1605 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1606 | 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
|
1607 | 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
|
1608 | 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
|
1609 | 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
|
1610 | 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
|
1611 | 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
|
1612 | 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
|
1613 | |
|
33015
20fdd5e3f446
Convert the Webview toolbar to a real GtkToolbar with GtkActions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33014
diff
changeset
|
1614 | g_signal_connect(G_OBJECT(hbox), "button-press-event", |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1615 | G_CALLBACK(pidgin_webviewtoolbar_popup_menu), toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1616 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1617 | |
|
32815
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1618 | /****************************************************************************** |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1619 | * Public API |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1620 | *****************************************************************************/ |
|
0ddffe446ee1
Re-arrange things a bit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32814
diff
changeset
|
1621 | |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1622 | GtkWidget * |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1623 | pidgin_webviewtoolbar_new(void) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1624 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1625 | return GTK_WIDGET(g_object_new(pidgin_webviewtoolbar_get_type(), NULL)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1626 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1627 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1628 | void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1629 | pidgin_webviewtoolbar_attach(PidginWebViewToolbar *toolbar, GtkWidget *webview) |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1630 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1631 | PidginWebViewButtons buttons; |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1632 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1633 | g_return_if_fail(toolbar != NULL); |
|
35506
4252b2882889
Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents:
35500
diff
changeset
|
1634 | g_return_if_fail(PIDGIN_IS_WEBVIEWTOOLBAR(toolbar)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1635 | g_return_if_fail(webview != NULL); |
|
35506
4252b2882889
Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents:
35500
diff
changeset
|
1636 | g_return_if_fail(PIDGIN_IS_WEBVIEW(webview)); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1637 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1638 | toolbar->webview = webview; |
|
32814
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1639 | 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
|
1640 | G_CALLBACK(update_buttons_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1641 | 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
|
1642 | G_CALLBACK(toggle_button_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1643 | 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
|
1644 | G_CALLBACK(update_format_cb), toolbar); |
|
6c18bb651f3d
Update the signals in the GtkWebViewToolbar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32806
diff
changeset
|
1645 | 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
|
1646 | 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
|
1647 | 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
|
1648 | 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
|
1649 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1650 | buttons = pidgin_webview_get_format_functions(PIDGIN_WEBVIEW(webview)); |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1651 | update_buttons_cb(PIDGIN_WEBVIEW(webview), buttons, toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1652 | 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
|
1653 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1654 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1655 | void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1656 | pidgin_webviewtoolbar_switch_active_conversation(PidginWebViewToolbar *toolbar, |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1657 | PurpleConversation *conv) |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1658 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1659 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1660 | pidgin_webviewtoolbar_get_instance_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
|
1661 | PurpleConnection *gc = purple_conversation_get_connection(conv); |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36577
diff
changeset
|
1662 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1663 | |
|
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
|
1664 | 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
|
1665 | |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1666 | /* 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
|
1667 | 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
|
1668 | gtk_action_set_sensitive(priv->attention, |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36541
diff
changeset
|
1669 | conv && protocol && PURPLE_IS_IM_CONVERSATION(conv) && |
|
38859
ed15916ec9ed
First pass at moving attention to it's own files
Gary Kramlich <grim@reaperworld.com>
parents:
38712
diff
changeset
|
1670 | PURPLE_IS_PROTOCOL_ATTENTION(protocol)); |
|
34283
800cf8ff15f8
Disable smileys button, if there are no smileys
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34282
diff
changeset
|
1671 | |
|
35738
030ce6840163
Smileys: toolbar button sensitivity
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35728
diff
changeset
|
1672 | update_smiley_button(toolbar); |
|
32806
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1673 | } |
|
b7a37f648129
Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1674 | |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1675 | void |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1676 | pidgin_webviewtoolbar_activate(PidginWebViewToolbar *toolbar, |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1677 | PidginWebViewAction action) |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1678 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1679 | PidginWebViewToolbarPrivate *priv; |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1680 | GtkAction *act; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1681 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1682 | g_return_if_fail(toolbar != NULL); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1683 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1684 | priv = pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1685 | switch (action) { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1686 | case PIDGIN_WEBVIEW_ACTION_BOLD: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1687 | act = priv->bold; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1688 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1689 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1690 | case PIDGIN_WEBVIEW_ACTION_ITALIC: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1691 | act = priv->italic; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1692 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1693 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1694 | case PIDGIN_WEBVIEW_ACTION_UNDERLINE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1695 | act = priv->underline; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1696 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1697 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1698 | case PIDGIN_WEBVIEW_ACTION_STRIKE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1699 | act = priv->strike; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1700 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1701 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1702 | case PIDGIN_WEBVIEW_ACTION_LARGER: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1703 | act = priv->larger_size; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1704 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1705 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1706 | #if 0 |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1707 | case PIDGIN_WEBVIEW_ACTION_NORMAL: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1708 | act = priv->normal_size; |
|
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 | #endif |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1711 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1712 | case PIDGIN_WEBVIEW_ACTION_SMALLER: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1713 | act = priv->smaller_size; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1714 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1715 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1716 | case PIDGIN_WEBVIEW_ACTION_FONTFACE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1717 | act = priv->font; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1718 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1719 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1720 | case PIDGIN_WEBVIEW_ACTION_FGCOLOR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1721 | act = priv->fgcolor; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1722 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1723 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1724 | case PIDGIN_WEBVIEW_ACTION_BGCOLOR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1725 | act = priv->bgcolor; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1726 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1727 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1728 | case PIDGIN_WEBVIEW_ACTION_CLEAR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1729 | act = priv->clear; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1730 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1731 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1732 | case PIDGIN_WEBVIEW_ACTION_IMAGE: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1733 | act = priv->image; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1734 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1735 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1736 | case PIDGIN_WEBVIEW_ACTION_LINK: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1737 | act = priv->link; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1738 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1739 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1740 | case PIDGIN_WEBVIEW_ACTION_HR: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1741 | act = priv->hr; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1742 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1743 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1744 | case PIDGIN_WEBVIEW_ACTION_SMILEY: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1745 | act = priv->smiley; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1746 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1747 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
1748 | case PIDGIN_WEBVIEW_ACTION_ATTENTION: |
|
33255
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1749 | act = priv->attention; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1750 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1751 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1752 | default: |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1753 | g_return_if_reached(); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1754 | break; |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1755 | } |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1756 | |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1757 | gtk_action_activate(act); |
|
0c8cfc86bdc2
Add method for activating GtkWebViewToolbar items.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33196
diff
changeset
|
1758 | } |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1759 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1760 | GtkWidget * |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1761 | pidgin_webviewtoolbar_get_wide_view(PidginWebViewToolbar *toolbar) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1762 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1763 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1764 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1765 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1766 | g_return_val_if_fail(toolbar != NULL, NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1767 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1768 | return priv->wide_view; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1769 | } |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1770 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1771 | GtkWidget * |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1772 | pidgin_webviewtoolbar_get_lean_view(PidginWebViewToolbar *toolbar) |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1773 | { |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1774 | PidginWebViewToolbarPrivate *priv = |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38859
diff
changeset
|
1775 | pidgin_webviewtoolbar_get_instance_private(toolbar); |
|
35935
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1776 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1777 | g_return_val_if_fail(toolbar != NULL, NULL); |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1778 | |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1779 | return priv->lean_view; |
|
98e92d543d73
Initial implementation fot the screencap plugin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35839
diff
changeset
|
1780 | } |