pidgin/gtkimhtmltoolbar.c

Mon, 27 Aug 2007 17:16:11 +0000

author
Sean Egan <seanegan@pidgin.im>
date
Mon, 27 Aug 2007 17:16:11 +0000
changeset 19647
5d8cf24e5ce9
parent 19213
e273393f4b75
child 19719
446e97aca498
permissions
-rw-r--r--

Add horizontal rules and strikethroughs to the toolbar

8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /*
10297
b36800725b7a [gaim-migrate @ 11480]
Evan Schoenberg <evands@pidgin.im>
parents: 10138
diff changeset
2 * @file gtkimhtmltoolbar.c GTK+ IMHtml Toolbar
16254
eeb2bba4dc94 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents: 15931
diff changeset
3 * @ingroup pidgin
10297
b36800725b7a [gaim-migrate @ 11480]
Evan Schoenberg <evands@pidgin.im>
parents: 10138
diff changeset
4 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
5 * pidgin
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
7 * Pidgin is the legal property of its developers, whose names are too numerous
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * source distribution.
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 *
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * under the terms of the GNU General Public License as published by
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 *
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 *
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 *
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 */
9791
f5c5bda0b96b [gaim-migrate @ 10659]
Gary Kramlich <grim@pidgin.im>
parents: 9730
diff changeset
26 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15571
diff changeset
27 #include "pidgin.h"
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
28
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
29 #include "imgstore.h"
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
30 #include "notify.h"
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31 #include "request.h"
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15847
diff changeset
32 #include "pidginstock.h"
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
33 #include "util.h"
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
34
9730
e59812364b8b [gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents: 9709
diff changeset
35 #include "gtkdialogs.h"
e59812364b8b [gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents: 9709
diff changeset
36 #include "gtkimhtmltoolbar.h"
11525
1d06283bdcc9 [gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents: 11314
diff changeset
37 #include "gtkthemes.h"
9730
e59812364b8b [gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents: 9709
diff changeset
38 #include "gtkutils.h"
e59812364b8b [gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents: 9709
diff changeset
39
17394
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
40 #include <gdk/gdkkeysyms.h>
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
41
10080
d562573fff16 [gaim-migrate @ 11062]
Sean Egan <seanegan@pidgin.im>
parents: 9971
diff changeset
42 static GtkHBoxClass *parent_class = NULL;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
43
11275
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
44 static void toggle_button_set_active_block(GtkToggleButton *button,
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
45 gboolean is_active,
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
46 GtkIMHtmlToolbar *toolbar);
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
47
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
48
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
49 static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
50 {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
51 g_return_if_fail(toolbar != NULL);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
52 gtk_imhtml_toggle_bold(GTK_IMHTML(toolbar->imhtml));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
53 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
55
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
56 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
57 do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
58 {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
59 g_return_if_fail(toolbar != NULL);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
60 gtk_imhtml_toggle_italic(GTK_IMHTML(toolbar->imhtml));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
61 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
62 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
63
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
64 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
65 do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
66 {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
67 g_return_if_fail(toolbar != NULL);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
68 gtk_imhtml_toggle_underline(GTK_IMHTML(toolbar->imhtml));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
69 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
70 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
71
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
72 static void
19647
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
73 do_strikethrough(GtkWidget *strikethrough, GtkIMHtmlToolbar *toolbar)
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
74 {
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
75 g_return_if_fail(toolbar != NULL);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
76 gtk_imhtml_toggle_strike(GTK_IMHTML(toolbar->imhtml));
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
77 gtk_widget_grab_focus(toolbar->imhtml);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
78 }
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
79
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
80 static void
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
81 do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
82 {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
83 g_return_if_fail(toolbar != NULL);
17403
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
84 /* Only shrink the font on activation, not deactivation as well */
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
85 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb)))
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
86 gtk_imhtml_font_shrink(GTK_IMHTML(toolbar->imhtml));
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
87 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
89
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
90 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
91 do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
92 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
93 g_return_if_fail(toolbar);
17403
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
94 /* Only grow the font on activation, not deactivation as well */
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
95 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large)))
b0e8707193b5 Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kstange@pidgin.im>
parents: 17303
diff changeset
96 gtk_imhtml_font_grow(GTK_IMHTML(toolbar->imhtml));
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
97 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
98 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
99
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
100 static void
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
101 destroy_toolbar_font(GtkWidget *widget, GdkEvent *event,
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
102 GtkIMHtmlToolbar *toolbar)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 {
10135
760803be53d2 [gaim-migrate @ 11202]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10134
diff changeset
104 if (widget != NULL)
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
105 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), "");
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
107 if (toolbar->font_dialog != NULL)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
108 {
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
109 gtk_widget_destroy(toolbar->font_dialog);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110 toolbar->font_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
111 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
114 static void
10125
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
115 realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
116 {
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
117 GtkFontSelection *sel;
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
118
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
119 sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel);
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
120 gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry));
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
121 gtk_widget_show_all(sel->family_list);
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
122 gtk_widget_show(gtk_widget_get_parent(sel->family_list));
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
123 gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list)));
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
124 }
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
125
dc406c15aceb [gaim-migrate @ 11162]
Tim Ringenbach <marv@pidgin.im>
parents: 10085
diff changeset
126 static void
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
127 cancel_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
128 {
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
129 destroy_toolbar_font(widget, NULL, toolbar);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
130 }
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
131
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
132 static void apply_font(GtkWidget *widget, GtkFontSelection *fontsel)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
133 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 /* this could be expanded to include font size, weight, etc.
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
135 but for now only works with font face */
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
136 char *fontname;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
137 char *space;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
138 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), "purple_toolbar");
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
139
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
140 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
142 space = strrchr(fontname, ' ');
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
143 if(space && isdigit(*(space+1)))
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144 *space = '\0';
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), fontname);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
147 g_free(fontname);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
149 cancel_toolbar_font(NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
151
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
152 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
153 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
154 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
155 g_return_if_fail(toolbar);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
156
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
157 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
158 char *fontname = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml));
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
159
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
160 if (!toolbar->font_dialog) {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
161 toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font"));
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
163 g_object_set_data(G_OBJECT(toolbar->font_dialog), "purple_toolbar", toolbar);
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
164
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
165 if(fontname) {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
166 char *fonttif = g_strdup_printf("%s 12", fontname);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
167 g_free(fontname);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
168 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog),
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
169 fonttif);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
170 g_free(fonttif);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
171 } else {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
172 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog),
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
173 DEFAULT_FONT_FACE);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
174 }
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
175
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
176 g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event",
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
177 G_CALLBACK(destroy_toolbar_font), toolbar);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
178 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked",
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
179 G_CALLBACK(apply_font), toolbar->font_dialog);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
180 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked",
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
181 G_CALLBACK(cancel_toolbar_font), toolbar);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
182 g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize",
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
183 G_CALLBACK(realize_toolbar_font), toolbar);
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
184 }
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
185 gtk_window_present(GTK_WINDOW(toolbar->font_dialog));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
186 } else {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
187 cancel_toolbar_font(font, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
188 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
189 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
190 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
191
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
192 static void
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
193 destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event,
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
194 GtkIMHtmlToolbar *toolbar)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
195 {
10135
760803be53d2 [gaim-migrate @ 11202]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10134
diff changeset
196 if (widget != NULL)
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
197 gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), "");
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
198
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
199 if (toolbar->fgcolor_dialog != NULL)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
200 {
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
201 gtk_widget_destroy(toolbar->fgcolor_dialog);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
202 toolbar->fgcolor_dialog = NULL;
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
203 }
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
204 }
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
205
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
206 static void cancel_toolbar_fgcolor(GtkWidget *widget,
8321
477316d4d8a3 [gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents: 8320
diff changeset
207 GtkIMHtmlToolbar *toolbar)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208 {
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
209 destroy_toolbar_fgcolor(widget, NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
211
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
212 static void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
213 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214 GdkColor text_color;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
215 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar");
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216 char *open_tag;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218 open_tag = g_malloc(30);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
219 gtk_color_selection_get_current_color(colorsel, &text_color);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 g_snprintf(open_tag, 23, "#%02X%02X%02X",
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
221 text_color.red / 256,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
222 text_color.green / 256,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
223 text_color.blue / 256);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), open_tag);
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
225 g_free(open_tag);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
226
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
227 cancel_toolbar_fgcolor(NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
229
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
230 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
231 toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
232 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234 GtkWidget *colorsel;
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
235 GdkColor fgcolor;
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10297
diff changeset
236 char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml));
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
237
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
238 if (!toolbar->fgcolor_dialog) {
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
239
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
240 toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
241 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel;
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
242 if (color) {
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
243 gdk_color_parse(color, &fgcolor);
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
244 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10297
diff changeset
245 g_free(color);
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
246 }
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
247
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
248 g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
249
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
250 g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event",
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
251 G_CALLBACK(destroy_toolbar_fgcolor), toolbar);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
252 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked",
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
253 G_CALLBACK(do_fgcolor), colorsel);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
254 g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked",
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
255 G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
256 }
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
257 gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog));
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
258 } else {
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
259 cancel_toolbar_fgcolor(color, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
260 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
261 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
264 static void
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
265 destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event,
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
266 GtkIMHtmlToolbar *toolbar)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267 {
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
268 if (widget != NULL) {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
269 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, NULL, NULL))
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
270 gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), "");
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
271 else
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
272 gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), "");
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
273 }
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
274
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
275 if (toolbar->bgcolor_dialog != NULL)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
276 {
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
277 gtk_widget_destroy(toolbar->bgcolor_dialog);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
278 toolbar->bgcolor_dialog = NULL;
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
279 }
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
280 }
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
281
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
282 static void
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
283 cancel_toolbar_bgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
284 {
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
285 destroy_toolbar_bgcolor(widget, NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
286 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
287
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
288 static void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
289 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
290 GdkColor text_color;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
291 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar");
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
292 char *open_tag;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
293
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
294 open_tag = g_malloc(30);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295 gtk_color_selection_get_current_color(colorsel, &text_color);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
296 g_snprintf(open_tag, 23, "#%02X%02X%02X",
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
297 text_color.red / 256,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
298 text_color.green / 256,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
299 text_color.blue / 256);
10777
5a9df3199615 [gaim-migrate @ 12392]
Sean Egan <seanegan@pidgin.im>
parents: 10732
diff changeset
300 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, NULL, NULL))
5a9df3199615 [gaim-migrate @ 12392]
Sean Egan <seanegan@pidgin.im>
parents: 10732
diff changeset
301 gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), open_tag);
5a9df3199615 [gaim-migrate @ 12392]
Sean Egan <seanegan@pidgin.im>
parents: 10732
diff changeset
302 else
5a9df3199615 [gaim-migrate @ 12392]
Sean Egan <seanegan@pidgin.im>
parents: 10732
diff changeset
303 gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), open_tag);
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
304 g_free(open_tag);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
305
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
306 cancel_toolbar_bgcolor(NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
307 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
308
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
309 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
310 toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
311 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
312 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
313 GtkWidget *colorsel;
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
314 GdkColor bgcolor;
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10297
diff changeset
315 char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml));
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
316
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
317 if (!toolbar->bgcolor_dialog) {
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
318
8359
3c62ea91eba8 [gaim-migrate @ 9083]
Mark Doliner <markdoliner@pidgin.im>
parents: 8325
diff changeset
319 toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color"));
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
320 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel;
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
321 if (color) {
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
322 gdk_color_parse(color, &bgcolor);
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
323 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10297
diff changeset
324 g_free(color);
9025
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
325 }
e49a72896270 [gaim-migrate @ 9801]
Luke Schierer <lschiere@pidgin.im>
parents: 8962
diff changeset
326
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
327 g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
328
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
329 g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event",
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
330 G_CALLBACK(destroy_toolbar_bgcolor), toolbar);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
331 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked",
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
332 G_CALLBACK(do_bgcolor), colorsel);
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
333 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked",
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
334 G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
335
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
336 }
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
337 gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog));
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
338 } else {
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
339 cancel_toolbar_bgcolor(color, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
340 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
341 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
342 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
343
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
344 static void
11271
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
345 clear_formatting_cb(GtkWidget *clear, GtkIMHtmlToolbar *toolbar)
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
346 {
11275
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
347 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->clear), FALSE, toolbar);
11271
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
348 gtk_imhtml_clear_formatting(GTK_IMHTML(toolbar->imhtml));
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
349 }
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
350
939be1fdbf7a [gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents: 11267
diff changeset
351 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
352 cancel_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
353 {
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
354 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
355
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
356 toolbar->link_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
357 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
358
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
359 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
360 close_link_dialog(GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
361 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
362 if (toolbar->link_dialog != NULL)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
363 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
364 purple_request_close(PURPLE_REQUEST_FIELDS, toolbar->link_dialog);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
365 toolbar->link_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
366 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
367 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
368
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
369 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
370 do_insert_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
371 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
372 const char *url, *description;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
373
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
374 url = purple_request_fields_get_string(fields, "url");
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
375 if (GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
376 description = purple_request_fields_get_string(fields, "description");
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
377 else
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
378 description = NULL;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
379
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
380 if (description == NULL)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
381 description = url;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
382
8677
18b494207322 [gaim-migrate @ 9430]
Tim Ringenbach <marv@pidgin.im>
parents: 8516
diff changeset
383 gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml),
18b494207322 [gaim-migrate @ 9430]
Tim Ringenbach <marv@pidgin.im>
parents: 8516
diff changeset
384 gtk_text_buffer_get_insert(GTK_IMHTML(toolbar->imhtml)->text_buffer),
18b494207322 [gaim-migrate @ 9430]
Tim Ringenbach <marv@pidgin.im>
parents: 8516
diff changeset
385 url, description);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
386
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
387 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
388
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
389 toolbar->link_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
390 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
391
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
392 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
393 insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
394 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
395 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
396 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
397 PurpleRequestFieldGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
398 PurpleRequestField *field;
9599
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
399 GtkTextIter start, end;
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
400 char *msg;
9599
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
401 char *desc = NULL;
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
402
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
403 fields = purple_request_fields_new();
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
404
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
405 group = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
406 purple_request_fields_add_group(fields, group);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
407
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
408 field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
409 purple_request_field_set_required(field, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
410 purple_request_field_group_add_field(group, field);
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
411
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
412 if(GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) {
9599
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
413 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, &start, &end)) {
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
414 desc = gtk_imhtml_get_text(GTK_IMHTML(toolbar->imhtml), &start, &end);
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
415 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
416 field = purple_request_field_string_new("description", _("_Description"),
9599
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
417 desc, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
418 purple_request_field_group_add_field(group, field);
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
419 msg = g_strdup(_("Please enter the URL and description of the "
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
420 "link that you want to insert. The description "
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
421 "is optional."));
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
422 } else {
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
423 msg = g_strdup(_("Please enter the URL of the "
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
424 "link that you want to insert."));
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
425 }
8319
6c18762beceb [gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents: 8317
diff changeset
426
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
427 toolbar->link_dialog =
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
428 purple_request_fields(toolbar, _("Insert Link"),
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
429 NULL,
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
430 msg,
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
431 fields,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
432 _("_Insert"), G_CALLBACK(do_insert_link_cb),
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
433 _("Cancel"), G_CALLBACK(cancel_link_cb),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16454
diff changeset
434 NULL, NULL, NULL,
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
435 toolbar);
9041
cbded2eb14d7 [gaim-migrate @ 9817]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9027
diff changeset
436 g_free(msg);
9599
1089c73e0586 [gaim-migrate @ 10442]
Tim Ringenbach <marv@pidgin.im>
parents: 9522
diff changeset
437 g_free(desc);
8322
9bae68fd2612 [gaim-migrate @ 9046]
Christian Hammond <chipx86@chipx86.com>
parents: 8321
diff changeset
438 } else {
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
439 close_link_dialog(toolbar);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
440 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
441 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
442 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
443
19647
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
444 static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
445 {
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
446 GtkTextIter iter;
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
447 GtkTextMark *ins;
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
448 GtkIMHtmlScalable *hr;
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
449
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
450 ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)));
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
451 gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
452 hr = gtk_imhtml_hr_new();
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
453 gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
454 }
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
455
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
456 static void
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
457 do_insert_image_cb(GtkWidget *widget, int response, GtkIMHtmlToolbar *toolbar)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
458 {
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
459 gchar *filename, *name, *buf;
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
460 char *filedata;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
461 size_t size;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
462 GError *error = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
463 int id;
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8892
diff changeset
464 GtkTextIter iter;
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8892
diff changeset
465 GtkTextMark *ins;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
466
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
467 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
468 if (response != GTK_RESPONSE_ACCEPT) {
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
469 #else /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
470 if (response != GTK_RESPONSE_OK) {
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
471 #endif /* FILECHOOSER */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
472 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
473 return;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
474 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
475
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
476 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
477 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
478 #else /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
479 filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget)));
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
480 #endif /* FILECHOOSER */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
481
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
482 if (filename == NULL) {
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
483 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
484 return;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
485 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
486
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
487 #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
488 if (pidgin_check_if_dir(filename, GTK_FILE_SELECTION(widget))) {
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
489 g_free(filename);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
490 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
491 return;
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
492 }
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
493 #endif /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
494
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
495 /* The following triggers a callback that closes the widget */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
496 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
497
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
498 if (!g_file_get_contents(filename, &filedata, &size, &error)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
499 purple_notify_error(NULL, NULL, error->message, NULL);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
500
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
501 g_error_free(error);
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
502 g_free(filename);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
503
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
504 return;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
505 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
506
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
507 name = strrchr(filename, G_DIR_SEPARATOR) + 1;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
508
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
509 id = purple_imgstore_add_with_id(filedata, size, name);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
510
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
511 if (id == 0) {
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
512 buf = g_strdup_printf(_("Failed to store image: %s\n"), filename);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
513 purple_notify_error(NULL, NULL, buf, NULL);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
514
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
515 g_free(buf);
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
516 g_free(filename);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
517
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
518 return;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
519 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
520
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
521 g_free(filename);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
522
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8892
diff changeset
523 ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)));
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8892
diff changeset
524 gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)),
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
525 &iter, ins);
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8892
diff changeset
526 gtk_imhtml_insert_image_at_iter(GTK_IMHTML(toolbar->imhtml), id, &iter);
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
527 purple_imgstore_unref_by_id(id);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
528 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
529
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
530
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
531 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
532 insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
533 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
534 GtkWidget *window;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
535
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
536 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) {
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
537 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
538 window = gtk_file_chooser_dialog_new(_("Insert Image"),
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
539 NULL,
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
540 GTK_FILE_CHOOSER_ACTION_OPEN,
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
541 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
542 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
543 NULL);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
544 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
545 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)),
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
546 "response", G_CALLBACK(do_insert_image_cb), toolbar);
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
547 #else /* FILECHOOSER */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
548 window = gtk_file_selection_new(_("Insert Image"));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
549 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
550 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)),
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
551 "response", G_CALLBACK(do_insert_image_cb), toolbar);
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
552 #endif /* FILECHOOSER */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
553
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
554 gtk_widget_show(window);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
555 toolbar->image_dialog = window;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
556 } else {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
557 gtk_widget_destroy(toolbar->image_dialog);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
558 toolbar->image_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
559 }
9522
e38381bd8c05 [gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents: 9287
diff changeset
560
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
561 gtk_widget_grab_focus(toolbar->imhtml);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
562 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
563
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
564
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
565 static void
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
566 destroy_smiley_dialog(GtkIMHtmlToolbar *toolbar)
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
567 {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
568 if (toolbar->smiley_dialog != NULL)
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
569 {
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
570 gtk_widget_destroy(toolbar->smiley_dialog);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
571 toolbar->smiley_dialog = NULL;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
572 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
573 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
574
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
575 static void
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
576 close_smiley_dialog(GtkWidget *widget, GdkEvent *event,
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
577 GtkIMHtmlToolbar *toolbar)
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
578 {
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
579 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE);
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
580 }
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
581
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
582
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
583 static void
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
584 insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
585 {
9027
d4e9c928e913 [gaim-migrate @ 9803]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9025
diff changeset
586 char *smiley_text, *escaped_smiley;
d4e9c928e913 [gaim-migrate @ 9803]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9025
diff changeset
587
d4e9c928e913 [gaim-migrate @ 9803]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9025
diff changeset
588 smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text");
10732
5e314ab498bf [gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents: 10504
diff changeset
589 escaped_smiley = g_markup_escape_text(smiley_text, -1);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
590
8456
63fcac86a8fd [gaim-migrate @ 9186]
Gary Kramlich <grim@pidgin.im>
parents: 8447
diff changeset
591 gtk_imhtml_insert_smiley(GTK_IMHTML(toolbar->imhtml),
63fcac86a8fd [gaim-migrate @ 9186]
Gary Kramlich <grim@pidgin.im>
parents: 8447
diff changeset
592 GTK_IMHTML(toolbar->imhtml)->protocol_name,
9027
d4e9c928e913 [gaim-migrate @ 9803]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9025
diff changeset
593 escaped_smiley);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
594
9027
d4e9c928e913 [gaim-migrate @ 9803]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9025
diff changeset
595 g_free(escaped_smiley);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
596
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
597 close_smiley_dialog(NULL, NULL, toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
598 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
599
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
600 /* smiley buttons list */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
601 struct smiley_button_list {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
602 int width, height;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
603 GtkWidget *button;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
604 struct smiley_button_list *next;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
605 };
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
606
11862
5d4bc6d54688 [gaim-migrate @ 14153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11849
diff changeset
607 static struct smiley_button_list *
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
608 sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, int *width, char *filename, char *face)
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
609 {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
610 GtkWidget *image;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
611 GtkWidget *button;
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
612 GtkRequisition size;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
613 struct smiley_button_list *cur;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
614 struct smiley_button_list *it, *it_last;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
615
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
616 cur = malloc(sizeof(struct smiley_button_list));
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
617 it = ls;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
618 it_last = ls; /* list iterators*/
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
619 image = gtk_image_new_from_file(filename);
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
620
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
621 gtk_widget_size_request(image, &size);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
622 (*width) += size.width;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
623
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
624 button = gtk_button_new();
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
625 gtk_container_add(GTK_CONTAINER(button), image);
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
626
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
627 g_object_set_data(G_OBJECT(button), "smiley_text", face);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
628 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
629
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
630 gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
631
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
632 /* these look really weird with borders */
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
633 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
634
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
635 /* set current element to add */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
636 cur->height = size.height;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
637 cur->width = size.width;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
638 cur->button = button;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
639 cur->next = ls;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
640
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
641 /* check where to insert by height */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
642 if (ls == NULL)
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
643 return cur;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
644 while (it != NULL) {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
645 it_last = it;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
646 it = it->next;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
647 }
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
648 cur->next = it;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
649 it_last->next = cur;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
650 return ls;
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
651 }
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
652
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
653 static gboolean
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
654 smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley)
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
655 {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
656 while (list) {
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
657 GtkIMHtmlSmiley *cur = list->data;
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
658 if (!strcmp(cur->file, smiley->file))
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
659 return FALSE;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
660 list = list->next;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
661 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
662 return TRUE;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
663 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
664
17394
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
665 static gboolean
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
666 smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar)
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
667 {
18546
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
668 if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) ||
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
669 (event->type == GDK_BUTTON_PRESS && event->button.button == 1))
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
670 {
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
671 close_smiley_dialog(NULL, NULL, toolbar);
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
672 return TRUE;
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
673 }
17394
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
674
18546
3515b5b454e9 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents: 18545
diff changeset
675 return FALSE;
17394
ebe5e0e583da Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17303
diff changeset
676 }
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
677
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
678 static void
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
679 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar)
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
680 {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
681 GtkWidget *dialog;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
682 GtkWidget *smiley_table = NULL;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
683 GSList *smileys, *unique_smileys = NULL;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
684
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
685 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
686 destroy_smiley_dialog(toolbar);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
687 gtk_widget_grab_focus(toolbar->imhtml);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
688 return;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
689 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
690
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
691 if (toolbar->sml)
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16254
diff changeset
692 smileys = pidgin_themes_get_proto_smileys(toolbar->sml);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
693 else
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16254
diff changeset
694 smileys = pidgin_themes_get_proto_smileys(NULL);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
695
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
696 while(smileys) {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
697 GtkIMHtmlSmiley *smiley = smileys->data;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
698 if(!smiley->hidden) {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
699 if(smiley_is_unique(unique_smileys, smiley))
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
700 unique_smileys = g_slist_append(unique_smileys, smiley);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
701 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
702 smileys = smileys->next;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
703 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
704
15571
812bd6c69c8c dialogs
Sean Egan <seanegan@pidgin.im>
parents: 15570
diff changeset
705 PIDGIN_DIALOG(dialog);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
706
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
707 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
708 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
709 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
710
15847
da522f9a7743 Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <markdoliner@pidgin.im>
parents: 15623
diff changeset
711 if (unique_smileys != NULL) {
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
712 struct smiley_button_list *ls, *it, *it_tmp;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
713 GtkWidget *line;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
714 int line_width = 0;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
715 int max_line_width, num_lines;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
716 int col=0;
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
717
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
718 /* We use hboxes packed in a vbox */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
719 ls = NULL;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
720 line = gtk_hbox_new(FALSE, 0);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
721 line_width = 0;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
722 max_line_width = 0;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
723 num_lines = floor(sqrt(g_slist_length(unique_smileys)));
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
724 smiley_table = gtk_vbox_new(FALSE, 0);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
725
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
726 /* create list of smileys sorted by height */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
727 while (unique_smileys) {
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
728 GtkIMHtmlSmiley *smiley = unique_smileys->data;
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
729 if (!smiley->hidden) {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
730 fflush(stdout);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
731 ls = sort_smileys(ls, toolbar, &max_line_width, smiley->file, smiley->smile);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
732 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
733 unique_smileys = unique_smileys->next;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
734 }
10894
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
735 /* pack buttons of the list */
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
736 max_line_width = max_line_width / num_lines;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
737 it = ls;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
738 while (it != NULL)
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
739 {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
740 it_tmp = it;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
741 gtk_box_pack_start(GTK_BOX(line), it->button, TRUE, TRUE, 0);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
742 gtk_widget_show(it->button);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
743 line_width += it->width;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
744 if (line_width >= max_line_width) {
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
745 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
746 line = gtk_hbox_new(FALSE, 0);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
747 line_width = 0;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
748 col = 0;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
749 }
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
750 col++;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
751 it = it->next;
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
752 free(it_tmp);
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
753 }
b75b237a1212 [gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents: 10814
diff changeset
754 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);
18547
cb6e8c0a08ca Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents: 18546
diff changeset
755
cb6e8c0a08ca Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents: 18546
diff changeset
756 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
757 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
758 else {
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
759 smiley_table = gtk_label_new(_("This theme has no available smileys."));
18547
cb6e8c0a08ca Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents: 18546
diff changeset
760 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK);
cb6e8c0a08ca Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents: 18546
diff changeset
761 g_signal_connect(G_OBJECT(dialog), "button-press-event", (GCallback)smiley_dialog_input_cb, toolbar);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
762 }
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
763
17398
1edf059a4a26 Forgot to remove spaces from before ;s
Gabriel Schulhof <nix@go-nix.ca>
parents: 17397
diff changeset
764 g_signal_connect(G_OBJECT(dialog), "key-press-event", (GCallback)smiley_dialog_input_cb, toolbar);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
765 gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
766
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
767 gtk_widget_show(smiley_table);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
768
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
769 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
770
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
771 /* connect signals */
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
772 g_signal_connect(G_OBJECT(dialog), "delete_event",
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
773 G_CALLBACK(close_smiley_dialog), toolbar);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
774
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
775 /* show everything */
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
776 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!"));
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
777 gtk_widget_show_all(dialog);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
778
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
779 toolbar->smiley_dialog = dialog;
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
780
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
781 gtk_widget_grab_focus(toolbar->imhtml);
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
782 }
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
783
8420
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
784 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar)
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
785 {
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
786 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_IMHTML_BOLD);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
787 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->italic), buttons & GTK_IMHTML_ITALIC);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
788 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->underline), buttons & GTK_IMHTML_UNDERLINE);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
789
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
790 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->larger_size), buttons & GTK_IMHTML_GROW);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
791 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smaller_size), buttons & GTK_IMHTML_SHRINK);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
792
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
793 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->font), buttons & GTK_IMHTML_FACE);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
794 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->fgcolor), buttons & GTK_IMHTML_FORECOLOR);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
795 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bgcolor), buttons & GTK_IMHTML_BACKCOLOR);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
796
11314
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
797 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->clear),
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
798 (buttons & GTK_IMHTML_BOLD ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
799 buttons & GTK_IMHTML_ITALIC ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
800 buttons & GTK_IMHTML_UNDERLINE ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
801 buttons & GTK_IMHTML_GROW ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
802 buttons & GTK_IMHTML_SHRINK ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
803 buttons & GTK_IMHTML_FACE ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
804 buttons & GTK_IMHTML_FORECOLOR ||
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
805 buttons & GTK_IMHTML_BACKCOLOR));
50888518c108 [gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents: 11313
diff changeset
806
8420
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
807 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->image), buttons & GTK_IMHTML_IMAGE);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
808 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->link), buttons & GTK_IMHTML_LINK);
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
809 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smiley), buttons & GTK_IMHTML_SMILEY);
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
810 }
8420
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
811
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
812 /* we call this when we want to _set_active the toggle button, it'll
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
813 * block the callback thats connected to the button so we don't have to
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
814 * do the double toggling hack
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
815 */
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
816 static void toggle_button_set_active_block(GtkToggleButton *button,
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
817 gboolean is_active,
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
818 GtkIMHtmlToolbar *toolbar)
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
819 {
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
820 GObject *object;
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
821 g_return_if_fail(toolbar);
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
822
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
823 object = g_object_ref(button);
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
824 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA,
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
825 0, 0, NULL, NULL, toolbar);
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
826 gtk_toggle_button_set_active(button, is_active);
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
827 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA,
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
828 0, 0, NULL, NULL, toolbar);
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
829 g_object_unref(object);
8420
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
830 }
71d59c4e2beb [gaim-migrate @ 9150]
Sean Egan <seanegan@pidgin.im>
parents: 8391
diff changeset
831
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
832 static void update_buttons(GtkIMHtmlToolbar *toolbar)
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
833 {
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
834 gboolean bold, italic, underline;
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
835 char *tmp;
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
836 char *tmp2;
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
837 GtkLabel *label = g_object_get_data(G_OBJECT(toolbar), "font_label");
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
838
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
839 gtk_label_set_label(label, _("_Font"));
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
840
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
841 gtk_imhtml_get_current_format(GTK_IMHTML(toolbar->imhtml),
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
842 &bold, &italic, &underline);
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
843
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
844 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold)
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
845 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold,
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
846 toolbar);
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
847 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic)
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
848 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic,
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
849 toolbar);
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
850
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
851 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->underline)) != underline)
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
852 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->underline),
8677
18b494207322 [gaim-migrate @ 9430]
Tim Ringenbach <marv@pidgin.im>
parents: 8516
diff changeset
853 underline, toolbar);
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
854
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
855 /* These buttons aren't ever "active". */
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
856 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
857 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
858
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
859 if (bold) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
860 gchar *markup = g_strdup_printf("<b>%s</b>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
861 gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
862 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
863 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
864 }
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
865 if (italic) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
866 gchar *markup = g_strdup_printf("<i>%s</i>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
867 gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
868 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
869 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
870 }
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
871 if (underline) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
872 gchar *markup = g_strdup_printf("<u>%s</u>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
873 gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
874 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
875 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
876 }
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
877
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
878 tmp = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml));
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
879 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font),
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
880 (tmp != NULL), toolbar);
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
881 if (tmp != NULL) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
882 gchar *markup = g_strdup_printf("<span font_desc=\"%s\">%s</span>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
883 tmp, gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
884 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
885 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
886 }
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
887 g_free(tmp);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
888
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
889 tmp = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml));
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
890 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor),
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
891 (tmp != NULL), toolbar);
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
892 if (tmp != NULL) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
893 gchar *markup = g_strdup_printf("<span foreground=\"%s\">%s</span>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
894 tmp, gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
895 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
896 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
897 }
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
898 g_free(tmp);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
899
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
900 tmp = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml));
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
901 tmp2 = gtk_imhtml_get_current_background(GTK_IMHTML(toolbar->imhtml));
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
902 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor),
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
903 (tmp != NULL || tmp2 != NULL), toolbar);
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
904 if (tmp != NULL) {
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
905 gchar *markup = g_strdup_printf("<span background=\"%s\">%s</span>",
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
906 tmp, gtk_label_get_label(label));
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
907 gtk_label_set_markup_with_mnemonic(label, markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
908 g_free(markup);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
909 }
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
910 g_free(tmp);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
911 g_free(tmp2);
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
912 }
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
913
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
914 static void toggle_button_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar)
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
915 {
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
916 update_buttons(toolbar);
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
917 }
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
918
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
919 static void update_format_cb(GtkIMHtml *imhtml, GtkIMHtmlToolbar *toolbar) {
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
920 update_buttons(toolbar);
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
921 }
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
922
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
923 static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location,
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
924 GtkTextMark *mark, GtkIMHtmlToolbar *toolbar)
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
925 {
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
926 if(mark != gtk_text_buffer_get_insert(buffer))
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
927 return;
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
928
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
929 update_buttons(toolbar);
8427
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
930 }
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
931
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
932
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
933 /* This comes from gtkmenutoolbutton.c from gtk+
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
934 * Copyright (C) 2003 Ricardo Fernandez Pascual
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
935 * Copyright (C) 2004 Paolo Borelli
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
936 */
17523
d26a1a21ea72 Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17498
diff changeset
937 static void
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
938 menu_position_func (GtkMenu *menu,
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
939 int *x,
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
940 int *y,
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
941 gboolean *push_in,
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
942 gpointer data)
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
943 {
18238
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
944 GtkWidget *widget = GTK_WIDGET(data);
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
945 GtkRequisition menu_req;
18238
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
946 gint ythickness = widget->style->ythickness;
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
947 int savy;
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
948
18238
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
949 gtk_widget_size_request(GTK_WIDGET (menu), &menu_req);
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
950 gdk_window_get_origin(widget->window, x, y);
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
951 *x += widget->allocation.x;
18238
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
952 *y += widget->allocation.y + widget->allocation.height;
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
953 savy = *y;
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
954
18238
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
955 pidgin_menu_position_func_helper(menu, x, y, push_in, data);
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
956
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
957 if (savy > *y + ythickness + 1)
b38c33d2d71e Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18185
diff changeset
958 *y -= widget->allocation.height;
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
959 }
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
960
19213
e273393f4b75 The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19199
diff changeset
961 static void pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu)
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
962 {
19104
35cd69038e67 show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@pidgin.im>
parents: 19089
diff changeset
963 gtk_widget_show_all(GTK_WIDGET(menu));
35cd69038e67 show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@pidgin.im>
parents: 19089
diff changeset
964 gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time());
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
965 }
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
966
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
967 static void pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button)
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
968 {
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
969 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
970 }
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
971
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
972 enum {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
973 LAST_SIGNAL
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
974 };
9863
323e4fe28791 [gaim-migrate @ 10742]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
975 /* static guint signals [LAST_SIGNAL] = { 0 }; */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
976
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
977 static void
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
978 gtk_imhtmltoolbar_finalize (GObject *object)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
979 {
8391
ed3b9c27d002 [gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents: 8380
diff changeset
980 GtkIMHtmlToolbar *toolbar = GTK_IMHTMLTOOLBAR(object);
19073
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
981 GtkWidget *menu;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
982
8685
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
983 if (toolbar->image_dialog != NULL)
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
984 {
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
985 gtk_widget_destroy(toolbar->image_dialog);
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
986 toolbar->image_dialog = NULL;
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
987 }
aea52455a3ba [gaim-migrate @ 9438]
Kevin Stange <kstange@pidgin.im>
parents: 8677
diff changeset
988
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
989 destroy_toolbar_font(NULL, NULL, toolbar);
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
990 destroy_smiley_dialog(toolbar);
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
991 destroy_toolbar_bgcolor(NULL, NULL, toolbar);
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
992 destroy_toolbar_fgcolor(NULL, NULL, toolbar);
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
993 close_link_dialog(toolbar);
12904
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
994 if (toolbar->imhtml) {
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
995 g_signal_handlers_disconnect_matched(toolbar->imhtml,
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
996 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
997 toolbar);
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
998 g_signal_handlers_disconnect_matched(GTK_IMHTML(toolbar->imhtml)->text_buffer,
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
999 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
1000 toolbar);
f01835b6bcac [gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12900
diff changeset
1001 }
8784
71c51aa52be4 [gaim-migrate @ 9546]
Kevin Stange <kstange@pidgin.im>
parents: 8756
diff changeset
1002
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13539
diff changeset
1003 free(toolbar->sml);
8391
ed3b9c27d002 [gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents: 8380
diff changeset
1004 gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1005
19073
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1006 menu = g_object_get_data(object, "font_menu");
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1007 if (menu)
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1008 gtk_widget_destroy(menu);
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1009 menu = g_object_get_data(object, "insert_menu");
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1010 if (menu)
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1011 gtk_widget_destroy(menu);
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1012
8391
ed3b9c27d002 [gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents: 8380
diff changeset
1013 G_OBJECT_CLASS(parent_class)->finalize (object);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1014 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1015
10814
7e17cb56b019 [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10777
diff changeset
1016 /* Boring GTK+ stuff */
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1017 static void gtk_imhtmltoolbar_class_init (GtkIMHtmlToolbarClass *class)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1018 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1019 GtkObjectClass *object_class;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1020 GObjectClass *gobject_class;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1021 object_class = (GtkObjectClass*) class;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1022 gobject_class = (GObjectClass*) class;
10080
d562573fff16 [gaim-migrate @ 11062]
Sean Egan <seanegan@pidgin.im>
parents: 9971
diff changeset
1023 parent_class = gtk_type_class(GTK_TYPE_HBOX);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1024 gobject_class->finalize = gtk_imhtmltoolbar_finalize;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1025 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1026
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1027 static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar)
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1028 {
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1029 GtkWidget *button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1030 /* Bold */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1031 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1032 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1033 G_CALLBACK(do_bold), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1034 toolbar->bold = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1035
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1036
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1037 /* Italic */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1038 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1039 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1040 G_CALLBACK(do_italic), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1041 toolbar->italic = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1042
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1043 /* Underline */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1044 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1045 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1046 G_CALLBACK(do_underline), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1047 toolbar->underline = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1048
19647
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1049
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1050 /* Strikethrough */
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1051 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_STRIKETHROUGH);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1052 g_signal_connect(G_OBJECT(button), "clicked",
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1053 G_CALLBACK(do_strikethrough), toolbar);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1054 toolbar->strikethrough = button;
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1055
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1056 /* Increase font size */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1057 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_TEXT_LARGER);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1058 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1059 G_CALLBACK(do_big), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1060 toolbar->larger_size = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1061
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1062 /* Decrease font size */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1063 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1064 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1065 G_CALLBACK(do_small), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1066 toolbar->smaller_size = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1067
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1068 /* Font Face */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1069
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1070 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_FONT_FACE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1071 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1072 G_CALLBACK(toggle_font), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1073 toolbar->font = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1074
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1075 /* Foreground Color */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1076 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_FGCOLOR);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1077 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1078 G_CALLBACK(toggle_fg_color), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1079 toolbar->fgcolor = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1080
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1081 /* Background Color */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1082 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_BGCOLOR);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1083 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1084 G_CALLBACK(toggle_bg_color), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1085 toolbar->bgcolor = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1086
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1087 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT_LINK);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1088 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1089 G_CALLBACK(insert_link_cb), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1090 toolbar->link = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1091
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1092 /* Insert IM Image */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1093 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1094 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1095 G_CALLBACK(insert_image_cb), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1096 toolbar->image = button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1097
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1098 /* Insert Smiley */
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1099 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1100 g_signal_connect(G_OBJECT(button), "clicked",
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1101 G_CALLBACK(insert_smiley_cb), toolbar);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1102 toolbar->smiley = button;
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1103
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1104 /* Reset formatting */
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1105 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY);
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1106 g_signal_connect(G_OBJECT(button), "clicked",
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1107 G_CALLBACK(clear_formatting_cb), toolbar);
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1108 toolbar->clear = button;
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1109 }
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1110
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1111 static void
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1112 button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1113 {
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1114 gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button));
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1115 }
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1116
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1117 static void
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1118 update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item)
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1119 {
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1120 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button);
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1121 gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button));
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1122 g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button);
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1123 }
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1124
19199
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1125 static void
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1126 enable_markup(GtkWidget *widget, gpointer null)
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1127 {
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1128 if (GTK_IS_LABEL(widget))
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1129 g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL);
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1130 }
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1131
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1132 static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar)
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1133 {
10085
83a9e1d81442 [gaim-migrate @ 11096]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10080
diff changeset
1134 GtkWidget *hbox = GTK_WIDGET(toolbar);
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1135 GtkWidget *bbox;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1136 GtkWidget *image;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1137 GtkWidget *label;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1138 GtkWidget *insert_button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1139 GtkWidget *font_button;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1140 GtkWidget *font_menu;
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1141 GtkWidget *insert_menu;
18240
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1142 GtkWidget *menuitem;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1143 GtkWidget *sep;
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1144 int i;
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1145 struct {
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1146 const char *label;
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1147 GtkWidget **button;
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1148 gboolean check;
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1149 } buttons[] = {
19199
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1150 {_("<b>_Bold</b>"), &toolbar->bold, TRUE},
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1151 {_("<i>_Italic</i>"), &toolbar->italic, TRUE},
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1152 {_("<u>_Underline</u>"), &toolbar->underline, TRUE},
19647
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1153 {_("<span strikethrough='true'>Strikethrough</span>"), &toolbar->strikethrough, TRUE},
19199
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1154 {_("<span size='larger'>_Larger</span>"), &toolbar->larger_size, TRUE},
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1155 #if 0
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1156 {_("_Normal"), &toolbar->normal_size, TRUE},
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1157 #endif
19199
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1158 {_("<span size='smaller'>_Smaller</span>"), &toolbar->smaller_size, TRUE},
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1159 /* If we want to show the formatting for the following items, we would
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1160 * need to update them when formatting changes. The above items don't need
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1161 * no updating nor nothin' */
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1162 {_("_Font face"), &toolbar->font, TRUE},
19083
14edbc247c42 I thought I fixed this already...
Kevin Stange <kstange@pidgin.im>
parents: 19076
diff changeset
1163 {_("Foreground _color"), &toolbar->fgcolor, TRUE},
19084
15f91e441bfb Another mnemonic conflict
Kevin Stange <kstange@pidgin.im>
parents: 19083
diff changeset
1164 {_("Bac_kground color"), &toolbar->bgcolor, TRUE},
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1165 {_("_Reset formatting"), &toolbar->clear, FALSE},
19088
8eb73fcef3ad Get rid of two minor compile warnings:
Mark Doliner <markdoliner@pidgin.im>
parents: 19076
diff changeset
1166 {NULL, NULL, FALSE}
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1167 };
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1168
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1169
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1170 toolbar->imhtml = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1171 toolbar->font_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1172 toolbar->fgcolor_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1173 toolbar->bgcolor_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1174 toolbar->link_dialog = NULL;
10138
b72c5fdc98b3 [gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents: 10135
diff changeset
1175 toolbar->smiley_dialog = NULL;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1176 toolbar->image_dialog = NULL;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1177
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1178 toolbar->tooltips = gtk_tooltips_new();
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
1179
17303
138cbb17e5cd disapproval of revision '6e8f285962e77199bf88dfc8d2a08386beb02634'
Sean Egan <seanegan@pidgin.im>
parents: 17300
diff changeset
1180 gtk_box_set_spacing(GTK_BOX(toolbar), 3);
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1181
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1182 gtk_imhtmltoolbar_create_old_buttons(toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1183
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1184 /* Fonts */
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1185 font_button = gtk_toggle_button_new();
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1186 gtk_button_set_relief(GTK_BUTTON(font_button), GTK_RELIEF_NONE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1187 bbox = gtk_hbox_new(FALSE, 3);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1188 gtk_container_add(GTK_CONTAINER(font_button), bbox);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1189 image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1190 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1191 label = gtk_label_new_with_mnemonic(_("_Font"));
19068
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
1192 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
4effc374e407 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents: 19061
diff changeset
1193 g_object_set_data(G_OBJECT(hbox), "font_label", label);
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1194 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1195 gtk_box_pack_start(GTK_BOX(hbox), font_button, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1196 gtk_widget_show_all(font_button);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1197
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1198 font_menu = gtk_menu_new();
19073
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1199 g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu);
17879
3e3f85138f1a merge of '87854ccfae544467c988edbac854c1ae2018eed4'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17620 17594
diff changeset
1200
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1201 for (i = 0; buttons[i].label; i++) {
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1202 GtkWidget *old = *buttons[i].button;
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1203 if (buttons[i].check) {
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1204 menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label);
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1205 g_signal_connect_after(G_OBJECT(old), "toggled",
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1206 G_CALLBACK(update_menuitem), menuitem);
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1207 } else {
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1208 menuitem = gtk_menu_item_new_with_mnemonic(buttons[i].label);
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1209 }
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1210 g_signal_connect_swapped(G_OBJECT(menuitem), "activate",
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1211 G_CALLBACK(gtk_button_clicked), old);
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1212 gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), menuitem);
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1213 g_signal_connect(G_OBJECT(old), "notify::sensitive",
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1214 G_CALLBACK(button_sensitiveness_changed), menuitem);
19199
f06d090eedab Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19104
diff changeset
1215 gtk_container_foreach(GTK_CONTAINER(menuitem), (GtkCallback)enable_markup, NULL);
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1216 }
19076
84216ea8ddbf Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents: 19073
diff changeset
1217
19213
e273393f4b75 The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19199
diff changeset
1218 g_signal_connect_swapped(G_OBJECT(font_button), "button-press-event", G_CALLBACK(gtk_widget_activate), font_button);
e273393f4b75 The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19199
diff changeset
1219 g_signal_connect(G_OBJECT(font_button), "activate", G_CALLBACK(pidgin_menu_clicked), font_menu);
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1220 g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1221
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1222 /* Sep */
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1223 sep = gtk_vseparator_new();
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1224 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1225 gtk_widget_show_all(sep);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1226
17594
837c8e6dbef7 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17523
diff changeset
1227 /* Insert */
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1228 insert_button = gtk_toggle_button_new();
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1229 gtk_button_set_relief(GTK_BUTTON(insert_button), GTK_RELIEF_NONE);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1230 bbox = gtk_hbox_new(FALSE, 3);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1231 gtk_container_add(GTK_CONTAINER(insert_button), bbox);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1232 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1233 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1234 label = gtk_label_new_with_mnemonic(_("_Insert"));
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1235 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1236 gtk_box_pack_start(GTK_BOX(hbox), insert_button, FALSE, FALSE, 0);
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1237 gtk_widget_show_all(insert_button);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1238
17498
9e21b4e8a98d Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents: 17403
diff changeset
1239 insert_menu = gtk_menu_new();
19073
e2da82ea455b Clean up the font and insert menus when the imhtmltoolbar is disposed of. This fixes a leak (and the crash in #2385). Fixes #2385.
Daniel Atallah <datallah@pidgin.im>
parents: 19068
diff changeset
1240 g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1241
18240
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1242 menuitem = gtk_menu_item_new_with_mnemonic(_("_Smiley"));
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1243 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smiley);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1244 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1245 g_signal_connect(G_OBJECT(toolbar->smiley), "notify::sensitive",
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1246 G_CALLBACK(button_sensitiveness_changed), menuitem);
17499
246d166626f3 disapproval of revision '9e21b4e8a98d7acd373a16a8b5d9c42ccc0f4a3d'
Sean Egan <seanegan@pidgin.im>
parents: 17498
diff changeset
1247
18240
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1248 menuitem = gtk_menu_item_new_with_mnemonic(_("_Image"));
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1249 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1250 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1251 g_signal_connect(G_OBJECT(toolbar->image), "notify::sensitive",
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1252 G_CALLBACK(button_sensitiveness_changed), menuitem);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1253
18240
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1254 menuitem = gtk_menu_item_new_with_mnemonic(_("_Link"));
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1255 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1256 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1257 g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive",
0a7d2fde749b Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18238
diff changeset
1258 G_CALLBACK(button_sensitiveness_changed), menuitem);
17499
246d166626f3 disapproval of revision '9e21b4e8a98d7acd373a16a8b5d9c42ccc0f4a3d'
Sean Egan <seanegan@pidgin.im>
parents: 17498
diff changeset
1259
19647
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1260 menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule"));
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1261 g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1262 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem);
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1263 toolbar->insert_hr = menuitem;
5d8cf24e5ce9 Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents: 19213
diff changeset
1264
19213
e273393f4b75 The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19199
diff changeset
1265 g_signal_connect_swapped(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(gtk_widget_activate), insert_button);
e273393f4b75 The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19199
diff changeset
1266 g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu);
17523
d26a1a21ea72 Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17498
diff changeset
1267 g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button);
8427
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1268 toolbar->sml = NULL;
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1269 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1270
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1271 GtkWidget *gtk_imhtmltoolbar_new()
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1272 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1273 return GTK_WIDGET(g_object_new(gtk_imhtmltoolbar_get_type(), NULL));
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1274 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1275
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1276 GType gtk_imhtmltoolbar_get_type()
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1277 {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1278 static GType imhtmltoolbar_type = 0;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1279
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1280 if (!imhtmltoolbar_type) {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1281 static const GTypeInfo imhtmltoolbar_info = {
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1282 sizeof(GtkIMHtmlToolbarClass),
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1283 NULL,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1284 NULL,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1285 (GClassInitFunc) gtk_imhtmltoolbar_class_init,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1286 NULL,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1287 NULL,
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1288 sizeof (GtkIMHtmlToolbar),
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1289 0,
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 11862
diff changeset
1290 (GInstanceInitFunc) gtk_imhtmltoolbar_init,
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 11862
diff changeset
1291 NULL
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1292 };
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1293
10080
d562573fff16 [gaim-migrate @ 11062]
Sean Egan <seanegan@pidgin.im>
parents: 9971
diff changeset
1294 imhtmltoolbar_type = g_type_register_static(GTK_TYPE_HBOX,
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1295 "GtkIMHtmlToolbar", &imhtmltoolbar_info, 0);
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1296 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1297
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1298 return imhtmltoolbar_type;
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1299 }
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1300
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1301
8324
3bb4ba19837d [gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents: 8322
diff changeset
1302 void gtk_imhtmltoolbar_attach(GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml)
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1303 {
8788
a13634443a38 [gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents: 8785
diff changeset
1304 GtkIMHtmlButtons buttons;
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
1305 gboolean bold, italic, underline;
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
1306
8325
bb6ed75fcec2 [gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents: 8324
diff changeset
1307 g_return_if_fail(toolbar != NULL);
bb6ed75fcec2 [gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents: 8324
diff changeset
1308 g_return_if_fail(GTK_IS_IMHTMLTOOLBAR(toolbar));
bb6ed75fcec2 [gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents: 8324
diff changeset
1309 g_return_if_fail(imhtml != NULL);
bb6ed75fcec2 [gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents: 8324
diff changeset
1310 g_return_if_fail(GTK_IS_IMHTML(imhtml));
bb6ed75fcec2 [gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents: 8324
diff changeset
1311
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1312 toolbar->imhtml = imhtml;
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
1313 g_signal_connect(G_OBJECT(imhtml), "format_buttons_update", G_CALLBACK(update_buttons_cb), toolbar);
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
1314 g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle", G_CALLBACK(toggle_button_cb), toolbar);
11275
cdcc651d7ecd [gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents: 11271
diff changeset
1315 g_signal_connect_after(G_OBJECT(imhtml), "format_function_clear", G_CALLBACK(update_format_cb), toolbar);
8506
76ce3a78b130 [gaim-migrate @ 9242]
Gary Kramlich <grim@pidgin.im>
parents: 8481
diff changeset
1316 g_signal_connect(G_OBJECT(imhtml), "format_function_update", G_CALLBACK(update_format_cb), toolbar);
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
1317 g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar);
8481
7a9eb76e8eee [gaim-migrate @ 9214]
Gary Kramlich <grim@pidgin.im>
parents: 8456
diff changeset
1318
8788
a13634443a38 [gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents: 8785
diff changeset
1319 buttons = gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml));
8807
128d3dae0196 [gaim-migrate @ 9569]
Jon Oberheide
parents: 8788
diff changeset
1320 update_buttons_cb(GTK_IMHTML(imhtml), buttons, toolbar);
8788
a13634443a38 [gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents: 8785
diff changeset
1321
8516
a29b503cdfa0 [gaim-migrate @ 9254]
Gary Kramlich <grim@pidgin.im>
parents: 8506
diff changeset
1322 gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), &bold, &italic, &underline);
10134
ecbf96117857 [gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents: 10125
diff changeset
1323
11267
78f1eb5b3d6e [gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents: 11243
diff changeset
1324 update_buttons(toolbar);
8317
fd4cf67705df [gaim-migrate @ 9041]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1325 }
8427
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1326
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1327 void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id)
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1328 {
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13539
diff changeset
1329 g_free(toolbar->sml);
8427
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1330 toolbar->sml = g_strdup(proto_id);
b99f5085af0a [gaim-migrate @ 9157]
Sean Egan <seanegan@pidgin.im>
parents: 8420
diff changeset
1331 }

mercurial