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