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