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