Mercurial > pidgin.yaz
annotate src/gtkimhtmltoolbar.c @ 8321:eb269b81fff8
[gaim-migrate @ 9045]
Fix the rest of the delete_event signal dialog mess.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 23 Feb 2004 22:26:08 +0000 |
parents | 5c6c8d48946f |
children | ffb601c6b833 |
rev | line source |
---|---|
8317 | 1 /* |
2 * GtkIMHtmlToolbar | |
3 * | |
4 * Gaim is the legal property of its developers, whose names are too numerous | |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 * | |
22 */ | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
23 #include "gtkinternal.h" |
8317 | 24 |
25 #include "gtkimhtmltoolbar.h" | |
26 #include "gtkutils.h" | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
27 |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
28 #include "imgstore.h" |
8317 | 29 #include "notify.h" |
30 #include "request.h" | |
31 #include "stock.h" | |
32 #include "ui.h" | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
33 #include "util.h" |
8317 | 34 |
35 static GtkVBoxClass *parent_class = NULL; | |
36 | |
37 static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar) | |
38 { | |
39 g_return_if_fail(toolbar); | |
40 gtk_imhtml_toggle_bold(GTK_IMHTML(toolbar->imhtml)); | |
41 gtk_widget_grab_focus(toolbar->imhtml); | |
42 } | |
43 | |
44 static void | |
45 do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar) | |
46 { | |
47 g_return_if_fail(toolbar); | |
48 gtk_imhtml_toggle_italic(GTK_IMHTML(toolbar->imhtml)); | |
49 gtk_widget_grab_focus(toolbar->imhtml); | |
50 } | |
51 | |
52 static void | |
53 do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar) | |
54 { | |
55 g_return_if_fail(toolbar); | |
56 gtk_imhtml_toggle_underline(GTK_IMHTML(toolbar->imhtml)); | |
57 gtk_widget_grab_focus(toolbar->imhtml); | |
58 } | |
59 | |
60 static void | |
61 do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar) | |
62 { | |
63 g_return_if_fail(toolbar); | |
64 gtk_imhtml_font_shrink(GTK_IMHTML(toolbar->imhtml)); | |
65 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE); | |
66 gtk_widget_grab_focus(toolbar->imhtml); | |
67 } | |
68 | |
69 static void | |
70 do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar) | |
71 { | |
72 g_return_if_fail(toolbar); | |
73 gtk_imhtml_font_grow(GTK_IMHTML(toolbar->imhtml)); | |
74 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE); | |
75 gtk_widget_grab_focus(toolbar->imhtml); | |
76 } | |
77 | |
78 | |
79 | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
80 static void toolbar_cancel_font(GtkWidget *widget, GdkEvent *event, |
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
81 GtkIMHtmlToolbar *toolbar) |
8317 | 82 { |
83 | |
84 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->font), FALSE); | |
85 | |
86 if (toolbar->font_dialog) { | |
87 gtk_widget_destroy(toolbar->font_dialog); | |
88 toolbar->font_dialog = NULL; | |
89 } | |
90 } | |
91 | |
92 static void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) | |
93 { | |
94 /* this could be expanded to include font size, weight, etc. | |
95 but for now only works with font face */ | |
96 char *fontname; | |
97 char *space; | |
98 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), "gaim_toolbar"); | |
99 | |
100 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); | |
101 | |
102 space = strrchr(fontname, ' '); | |
103 if(space && isdigit(*(space+1))) | |
104 *space = '\0'; | |
105 | |
106 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), fontname); | |
107 | |
108 g_free(fontname); | |
109 | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
110 toolbar_cancel_font(NULL, NULL, toolbar); |
8317 | 111 } |
112 | |
113 static void | |
114 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) | |
115 { | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
116 #if 0 |
8317 | 117 char fonttif[128]; |
118 const char *fontface; | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
119 #endif |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
120 |
8317 | 121 g_return_if_fail(toolbar); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
122 |
8317 | 123 if (!toolbar->font_dialog) { |
124 toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); | |
125 | |
126 g_object_set_data(G_OBJECT(toolbar->font_dialog), "gaim_toolbar", toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
127 |
8317 | 128 /* if (gtkconv->fontface[0]) { |
129 g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface); | |
130 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), | |
131 fonttif); | |
132 } else { | |
133 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font), | |
134 DEFAULT_FONT_FACE); | |
135 } | |
136 */ | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
137 |
8317 | 138 g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", |
139 G_CALLBACK(toolbar_cancel_font), toolbar); | |
140 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), | |
141 "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); | |
142 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), | |
143 "clicked", G_CALLBACK(toolbar_cancel_font), toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
144 |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
145 |
8317 | 146 gtk_window_present(GTK_WINDOW(toolbar->font_dialog)); |
147 } else { | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
148 toolbar_cancel_font(NULL, NULL, toolbar); |
8317 | 149 } |
150 gtk_widget_grab_focus(toolbar->imhtml); | |
151 } | |
152 | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
153 static void cancel_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, |
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
154 GtkIMHtmlToolbar *toolbar) |
8317 | 155 { |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
156 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->fgcolor), FALSE); |
8317 | 157 gtk_widget_destroy(toolbar->fgcolor_dialog); |
158 toolbar->fgcolor_dialog = NULL; | |
159 } | |
160 | |
161 static void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | |
162 { | |
163 GdkColor text_color; | |
164 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "gaim_toolbar"); | |
165 char *open_tag; | |
166 | |
167 open_tag = g_malloc(30); | |
168 gtk_color_selection_get_current_color(colorsel, &text_color); | |
169 g_snprintf(open_tag, 23, "#%02X%02X%02X", | |
170 text_color.red / 256, | |
171 text_color.green / 256, | |
172 text_color.blue / 256); | |
173 gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), open_tag); | |
174 | |
175 g_free(open_tag); | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
176 cancel_toolbar_fgcolor(NULL, NULL, toolbar); |
8317 | 177 } |
178 | |
179 static void | |
180 toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) | |
181 { | |
182 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { | |
183 GtkWidget *colorsel; | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
184 /* GdkColor fgcolor; */ |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
185 |
8317 | 186 /*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
187 &fgcolor);*/ | |
188 if (!toolbar->fgcolor_dialog) { | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
189 |
8317 | 190 toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); |
191 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; | |
192 //gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); | |
193 g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
194 |
8317 | 195 g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", |
196 G_CALLBACK(cancel_toolbar_fgcolor), toolbar); | |
197 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), | |
198 "clicked", G_CALLBACK(do_fgcolor), colorsel); | |
199 g_signal_connect(G_OBJECT | |
200 (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), | |
201 "clicked", G_CALLBACK(cancel_toolbar_fgcolor), toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
202 |
8317 | 203 } |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
204 gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); |
8317 | 205 } else if (toolbar->fgcolor_dialog != NULL) { |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
206 cancel_toolbar_fgcolor(color, NULL, toolbar); |
8317 | 207 } else { |
208 //gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
209 } | |
210 gtk_widget_grab_focus(toolbar->imhtml); | |
211 } | |
212 | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
213 static void cancel_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, |
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
214 GtkIMHtmlToolbar *toolbar) |
8317 | 215 { |
216 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->bgcolor), FALSE); | |
217 gtk_widget_destroy(toolbar->bgcolor_dialog); | |
218 toolbar->bgcolor_dialog = NULL; | |
219 } | |
220 | |
221 static void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | |
222 { | |
223 GdkColor text_color; | |
224 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "gaim_toolbar"); | |
225 char *open_tag; | |
226 | |
227 open_tag = g_malloc(30); | |
228 gtk_color_selection_get_current_color(colorsel, &text_color); | |
229 g_snprintf(open_tag, 23, "#%02X%02X%02X", | |
230 text_color.red / 256, | |
231 text_color.green / 256, | |
232 text_color.blue / 256); | |
233 gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), open_tag); | |
234 | |
235 g_free(open_tag); | |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
236 cancel_toolbar_bgcolor(NULL, NULL, toolbar); |
8317 | 237 } |
238 | |
239 static void | |
240 toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) | |
241 { | |
242 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { | |
243 GtkWidget *colorsel; | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
244 /* GdkColor bgcolor; */ |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
245 |
8317 | 246 /*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
247 &bgcolor);*/ | |
248 if (!toolbar->bgcolor_dialog) { | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
249 |
8317 | 250 toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); |
251 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; | |
252 //gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); | |
253 g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
254 |
8317 | 255 g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", |
256 G_CALLBACK(cancel_toolbar_bgcolor), toolbar); | |
257 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), | |
258 "clicked", G_CALLBACK(do_bgcolor), colorsel); | |
259 g_signal_connect(G_OBJECT | |
260 (GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), | |
261 "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
262 |
8317 | 263 } |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
264 gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog)); |
8317 | 265 } else if (toolbar->bgcolor_dialog != NULL) { |
8321
eb269b81fff8
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
266 cancel_toolbar_bgcolor(color, NULL, toolbar); |
8317 | 267 } else { |
268 //gaim_gtk_advance_past(gtkconv, "<FONT COLOR>", "</FONT>"); | |
269 } | |
270 gtk_widget_grab_focus(toolbar->imhtml); | |
271 } | |
272 | |
273 static void | |
274 cancel_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields) | |
275 { | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
276 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); |
8317 | 277 toolbar->link_dialog = NULL; |
278 } | |
279 | |
280 static void | |
281 close_link_dialog(GtkIMHtmlToolbar *toolbar) | |
282 { | |
283 if (toolbar->link_dialog != NULL) | |
284 { | |
285 gaim_request_close(GAIM_REQUEST_FIELDS, toolbar->link_dialog); | |
286 toolbar->link_dialog = NULL; | |
287 } | |
288 } | |
289 | |
290 static void | |
291 do_insert_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields) | |
292 { | |
293 const char *url, *description; | |
294 | |
295 url = gaim_request_fields_get_string(fields, "url"); | |
296 description = gaim_request_fields_get_string(fields, "description"); | |
297 | |
298 if (description == NULL) | |
299 description = url; | |
300 | |
301 gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), url, description); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
302 |
8317 | 303 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); |
304 | |
305 toolbar->link_dialog = NULL; | |
306 } | |
307 | |
308 static void | |
309 insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar) | |
310 { | |
311 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { | |
312 GaimRequestFields *fields; | |
313 GaimRequestFieldGroup *group; | |
314 GaimRequestField *field; | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
315 |
8317 | 316 fields = gaim_request_fields_new(); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
317 |
8317 | 318 group = gaim_request_field_group_new(NULL); |
319 gaim_request_fields_add_group(fields, group); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
320 |
8317 | 321 field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE); |
322 gaim_request_field_set_required(field, TRUE); | |
323 gaim_request_field_group_add_field(group, field); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
324 |
8317 | 325 field = gaim_request_field_string_new("description", _("_Description"), |
326 NULL, FALSE); | |
327 gaim_request_field_group_add_field(group, field); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
328 |
8317 | 329 toolbar->link_dialog = |
330 gaim_request_fields(toolbar, _("Insert Link"), | |
331 NULL, | |
332 _("Please enter the URL and description of the " | |
333 "link that you want to insert. The description " | |
334 "is optional."), | |
335 fields, | |
336 _("_Insert"), G_CALLBACK(do_insert_link_cb), | |
337 _("Cancel"), G_CALLBACK(cancel_link_cb), | |
338 toolbar); | |
339 } else { | |
340 close_link_dialog(toolbar); | |
341 } | |
342 gtk_widget_grab_focus(toolbar->imhtml); | |
343 } | |
344 | |
345 | |
346 static void | |
347 do_insert_image_cb(GtkWidget *widget, int resp, GtkIMHtmlToolbar *toolbar) | |
348 { | |
349 char *name, *filename; | |
350 char *buf, *filedata; | |
351 size_t size; | |
352 GError *error = NULL; | |
353 int id; | |
354 | |
355 if (resp != GTK_RESPONSE_OK) { | |
356 //set_toggle(toolbar->image, FALSE); | |
357 gtk_widget_destroy(widget); | |
358 toolbar->image_dialog = NULL; | |
359 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); | |
360 return; | |
361 } | |
362 | |
363 name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget))); | |
364 | |
365 if (!name) { | |
366 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); | |
367 return; | |
368 } | |
369 | |
370 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(widget))) { | |
371 g_free(name); | |
372 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); | |
373 return; | |
374 } | |
375 | |
376 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); | |
377 | |
378 if (!g_file_get_contents(name, &filedata, &size, &error)) { | |
379 gaim_notify_error(NULL, NULL, error->message, NULL); | |
380 | |
381 g_error_free(error); | |
382 g_free(name); | |
383 | |
384 return; | |
385 } | |
386 | |
387 filename = name; | |
388 while (strchr(filename, '/')) | |
389 filename = strchr(filename, '/') + 1; | |
390 | |
391 id = gaim_imgstore_add(filedata, size, filename); | |
392 g_free(filedata); | |
393 | |
394 if (!id) { | |
395 buf = g_strdup_printf(_("Failed to store image: %s\n"), name); | |
396 gaim_notify_error(NULL, NULL, buf, NULL); | |
397 | |
398 g_free(buf); | |
399 g_free(name); | |
400 | |
401 return; | |
402 } | |
403 | |
404 //im->images = g_slist_append(im->images, GINT_TO_POINTER(id)); | |
405 | |
406 /*buf = g_strdup_printf("<IMG ID=\"%d\" SRC=\"file://%s\">", id, filename); | |
407 gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(gtkconv->entry_buffer), buf, -1); | |
408 g_free(buf); | |
409 */ | |
410 g_free(name); | |
411 } | |
412 | |
413 | |
414 static void | |
415 insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar) | |
416 { | |
417 char buf[BUF_LONG]; | |
418 GtkWidget *window; | |
419 | |
420 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) { | |
421 window = gtk_file_selection_new(_("Insert Image")); | |
422 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); | |
423 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
424 | |
425 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK); | |
426 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)), | |
427 "response", G_CALLBACK(do_insert_image_cb), toolbar); | |
428 | |
429 gtk_widget_show(window); | |
430 toolbar->image_dialog = window; | |
431 } else { | |
432 gtk_widget_destroy(toolbar->image_dialog); | |
433 toolbar->image_dialog = NULL; | |
434 } | |
435 gtk_widget_grab_focus(toolbar->imhtml); | |
436 } | |
437 | |
438 | |
8320
5c6c8d48946f
[gaim-migrate @ 9044]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
439 void close_smiley_dialog(GtkWidget *widget, GdkEvent *event, |
5c6c8d48946f
[gaim-migrate @ 9044]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
440 GtkIMHtmlToolbar *toolbar) |
8317 | 441 { |
442 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
443 |
8317 | 444 if (toolbar->smiley_dialog) { |
445 gtk_widget_destroy(toolbar->smiley_dialog); | |
446 toolbar->smiley_dialog = NULL; | |
447 } | |
448 } | |
449 | |
450 | |
451 void insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) | |
452 { | |
453 char *smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); | |
454 //GaimPlugin *proto = gaim_find_prpl(gaim_account_get_protocol_id(gaim_conversation_get_account(c))); | |
455 | |
456 gtk_imhtml_insert_smiley(GTK_IMHTML(toolbar->imhtml), NULL, smiley_text); //proto->info->name, smiley_text); | |
457 | |
8320
5c6c8d48946f
[gaim-migrate @ 9044]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
458 close_smiley_dialog(NULL, NULL, toolbar); |
8317 | 459 } |
460 | |
461 | |
462 static void add_smiley(GtkIMHtmlToolbar *toolbar, GtkWidget *table, int row, int col, char *filename, char *face) | |
463 { | |
464 GtkWidget *image; | |
465 GtkWidget *button; | |
466 | |
467 image = gtk_image_new_from_file(filename); | |
468 button = gtk_button_new(); | |
469 gtk_container_add(GTK_CONTAINER(button), image); | |
470 g_object_set_data(G_OBJECT(button), "smiley_text", face); | |
471 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); | |
472 | |
473 gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); | |
474 | |
475 gtk_table_attach_defaults(GTK_TABLE(table), button, col, col+1, row, row+1); | |
476 | |
477 /* these look really weird with borders */ | |
478 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
479 | |
480 gtk_widget_show(button); | |
481 } | |
482 | |
483 | |
484 static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) { | |
485 while(list) { | |
486 GtkIMHtmlSmiley *cur = list->data; | |
487 if(!strcmp(cur->file, smiley->file)) | |
488 return FALSE; | |
489 list = list->next; | |
490 } | |
491 return TRUE; | |
492 } | |
493 | |
494 | |
495 static void | |
496 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) | |
497 { | |
498 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
499 |
8317 | 500 GtkWidget *dialog; |
501 GtkWidget *smiley_table = NULL; | |
502 GSList *smileys, *unique_smileys = NULL; | |
503 int width; | |
504 int row = 0, col = 0; | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
505 |
8317 | 506 if (toolbar->smiley_dialog) { |
507 gtk_widget_grab_focus(toolbar->imhtml); | |
508 return; | |
509 } | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
510 |
8317 | 511 /* |
512 if(c->account) | |
513 smileys = get_proto_smileys( | |
514 gaim_account_get_protocol_id(gaim_conversation_get_account(c))); | |
515 else | |
516 */ | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
517 |
8317 | 518 smileys = get_proto_smileys(GAIM_PROTO_DEFAULT); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
519 |
8317 | 520 while(smileys) { |
521 GtkIMHtmlSmiley *smiley = smileys->data; | |
522 if(!smiley->hidden) { | |
523 if(smiley_is_unique(unique_smileys, smiley)) | |
524 unique_smileys = g_slist_append(unique_smileys, smiley); | |
525 } | |
526 smileys = smileys->next; | |
527 } | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
528 |
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
529 |
8317 | 530 width = floor(sqrt(g_slist_length(unique_smileys))); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
531 |
8317 | 532 GAIM_DIALOG(dialog); |
533 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | |
534 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog"); | |
535 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
536 |
8317 | 537 smiley_table = gtk_table_new(width, width, TRUE); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
538 |
8317 | 539 /* pack buttons */ |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
540 |
8317 | 541 while(unique_smileys) { |
542 GtkIMHtmlSmiley *smiley = unique_smileys->data; | |
543 if(!smiley->hidden) { | |
544 add_smiley(toolbar, smiley_table, row, col, smiley->file, smiley->smile); | |
545 if(++col >= width) { | |
546 col = 0; | |
547 row++; | |
548 } | |
549 } | |
550 unique_smileys = unique_smileys->next; | |
551 } | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
552 |
8317 | 553 gtk_container_add(GTK_CONTAINER(dialog), smiley_table); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
554 |
8317 | 555 gtk_widget_show(smiley_table); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
556 |
8317 | 557 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
558 |
8317 | 559 /* connect signals */ |
560 g_object_set_data(G_OBJECT(dialog), "dialog_type", "smiley dialog"); | |
561 g_signal_connect(G_OBJECT(dialog), "delete_event", | |
562 G_CALLBACK(close_smiley_dialog), toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
563 |
8317 | 564 /* show everything */ |
565 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!")); | |
566 gtk_widget_show_all(dialog); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
567 |
8317 | 568 toolbar->smiley_dialog = dialog; |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
569 |
8317 | 570 } else if (toolbar->smiley_dialog) { |
8320
5c6c8d48946f
[gaim-migrate @ 9044]
Christian Hammond <chipx86@chipx86.com>
parents:
8319
diff
changeset
|
571 close_smiley_dialog(smiley, NULL, toolbar); |
8317 | 572 } |
573 gtk_widget_grab_focus(toolbar->imhtml); | |
574 } | |
575 | |
576 enum { | |
577 LAST_SIGNAL | |
578 }; | |
579 //static guint signals [LAST_SIGNAL] = { 0 }; | |
580 | |
581 static void | |
582 gtk_imhtmltoolbar_finalize (GObject *object) | |
583 { | |
584 /*GtkIMHtml *imhtml = GTK_IMHTML(object); | |
585 GList *scalables; | |
586 | |
587 g_hash_table_destroy(imhtml->smiley_data); | |
588 gtk_smiley_tree_destroy(imhtml->default_smilies); | |
589 gdk_cursor_unref(imhtml->hand_cursor); | |
590 gdk_cursor_unref(imhtml->arrow_cursor); | |
591 gdk_cursor_unref(imhtml->text_cursor); | |
592 if(imhtml->tip_window){ | |
593 gtk_widget_destroy(imhtml->tip_window); | |
594 } | |
595 if(imhtml->tip_timer) | |
596 gtk_timeout_remove(imhtml->tip_timer); | |
597 | |
598 for(scalables = imhtml->scalables; scalables; scalables = scalables->next) { | |
599 GtkIMHtmlScalable *scale = GTK_IMHTML_SCALABLE(scalables->data); | |
600 scale->free(scale); | |
601 } | |
602 | |
603 g_list_free(imhtml->scalables); | |
604 G_OBJECT_CLASS(parent_class)->finalize (object);*/ | |
605 } | |
606 | |
607 /* Boring GTK stuff */ | |
608 static void gtk_imhtmltoolbar_class_init (GtkIMHtmlToolbarClass *class) | |
609 { | |
610 GtkObjectClass *object_class; | |
611 GObjectClass *gobject_class; | |
612 object_class = (GtkObjectClass*) class; | |
613 gobject_class = (GObjectClass*) class; | |
614 parent_class = gtk_type_class(GTK_TYPE_VBOX); | |
615 /* signals[URL_CLICKED] = g_signal_new(url_clicked", | |
616 G_TYPE_FROM_CLASS(gobject_class), | |
617 G_SIGNAL_RUN_FIRST, | |
618 G_STRUCT_OFFSET(GtkIMHtmlClass, url_clicked), | |
619 NULL, | |
620 0, | |
621 g_cclosure_marshal_VOID__POINTER, | |
622 G_TYPE_NONE, 1, | |
623 G_TYPE_POINTER);*/ | |
624 gobject_class->finalize = gtk_imhtmltoolbar_finalize; | |
625 } | |
626 | |
627 static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) | |
628 { | |
629 GtkWidget *hbox; | |
630 GtkWidget *button; | |
631 GtkWidget *sep; | |
632 GtkSizeGroup *sg; | |
633 | |
634 toolbar->imhtml = NULL; | |
635 toolbar->font_dialog = NULL; | |
636 toolbar->fgcolor_dialog = NULL; | |
637 toolbar->bgcolor_dialog = NULL; | |
638 toolbar->link_dialog = NULL; | |
639 toolbar->smiley_dialog = NULL; | |
640 toolbar->image_dialog = NULL; | |
641 | |
642 toolbar->tooltips = gtk_tooltips_new(); | |
643 | |
644 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
645 | |
646 sep = gtk_hseparator_new(); | |
647 gtk_box_pack_start(GTK_BOX(toolbar), sep, FALSE, FALSE, 0); | |
648 gtk_widget_show(sep); | |
649 | |
650 hbox = gtk_hbox_new(FALSE, 6); | |
651 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); | |
652 | |
653 /* Bold */ | |
654 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD); | |
655 gtk_size_group_add_widget(sg, button); | |
656 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
657 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Bold"), NULL); | |
658 | |
659 g_signal_connect(G_OBJECT(button), "clicked", | |
660 G_CALLBACK(do_bold), toolbar); | |
661 | |
662 toolbar->bold = button; | |
663 | |
664 /* Italic */ | |
665 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC); | |
666 gtk_size_group_add_widget(sg, button); | |
667 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
668 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Italic"), NULL); | |
669 | |
670 g_signal_connect(G_OBJECT(button), "clicked", | |
671 G_CALLBACK(do_italic), toolbar); | |
672 | |
673 toolbar->italic = button; | |
674 | |
675 /* Underline */ | |
676 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE); | |
677 gtk_size_group_add_widget(sg, button); | |
678 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
679 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Underline"), NULL); | |
680 | |
681 g_signal_connect(G_OBJECT(button), "clicked", | |
682 G_CALLBACK(do_underline), toolbar); | |
683 | |
684 toolbar->underline = button; | |
685 | |
686 /* Sep */ | |
687 sep = gtk_vseparator_new(); | |
688 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
689 | |
690 /* Increase font size */ | |
691 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_BIGGER); | |
692 gtk_size_group_add_widget(sg, button); | |
693 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
694 gtk_tooltips_set_tip(toolbar->tooltips, button, | |
695 _("Larger font size"), NULL); | |
696 | |
697 g_signal_connect(G_OBJECT(button), "clicked", | |
698 G_CALLBACK(do_big), toolbar); | |
699 | |
700 toolbar->larger_size = button; | |
701 | |
702 /* Decrease font size */ | |
703 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_TEXT_SMALLER); | |
704 gtk_size_group_add_widget(sg, button); | |
705 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
706 gtk_tooltips_set_tip(toolbar->tooltips, button, | |
707 _("Smaller font size"), NULL); | |
708 | |
709 g_signal_connect(G_OBJECT(button), "clicked", | |
710 G_CALLBACK(do_small), toolbar); | |
711 | |
712 toolbar->smaller_size = button; | |
713 | |
714 /* Sep */ | |
715 sep = gtk_vseparator_new(); | |
716 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
717 | |
718 /* Font Face */ | |
719 | |
720 button = gaim_pixbuf_toolbar_button_from_stock(GTK_STOCK_SELECT_FONT); | |
721 gtk_size_group_add_widget(sg, button); | |
722 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
723 gtk_tooltips_set_tip(toolbar->tooltips, button, | |
724 _("Font Face"), NULL); | |
725 | |
726 g_signal_connect(G_OBJECT(button), "clicked", | |
727 G_CALLBACK(toggle_font), toolbar); | |
728 | |
729 toolbar->font = button; | |
730 | |
731 /* Foreground Color */ | |
732 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_FGCOLOR); | |
733 gtk_size_group_add_widget(sg, button); | |
734 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
735 gtk_tooltips_set_tip(toolbar->tooltips, button, | |
736 _("Foreground font color"), NULL); | |
737 | |
738 g_signal_connect(G_OBJECT(button), "clicked", | |
739 G_CALLBACK(toggle_fg_color), toolbar); | |
740 | |
741 toolbar->fgcolor = button; | |
742 | |
743 /* Background Color */ | |
744 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_BGCOLOR); | |
745 gtk_size_group_add_widget(sg, button); | |
746 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
747 gtk_tooltips_set_tip(toolbar->tooltips, button, | |
748 _("Background color"), NULL); | |
749 | |
750 g_signal_connect(G_OBJECT(button), "clicked", | |
751 G_CALLBACK(toggle_bg_color), toolbar); | |
752 | |
753 toolbar->bgcolor = button; | |
754 | |
755 /* Sep */ | |
756 sep = gtk_vseparator_new(); | |
757 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
758 | |
759 /* Insert Link */ | |
760 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_LINK); | |
761 gtk_size_group_add_widget(sg, button); | |
762 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
763 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert link"), NULL); | |
764 g_signal_connect(G_OBJECT(button), "clicked", | |
765 G_CALLBACK(insert_link_cb), toolbar); | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
766 |
8317 | 767 toolbar->link = button; |
768 | |
769 /* Insert IM Image */ | |
770 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_IMAGE); | |
771 gtk_size_group_add_widget(sg, button); | |
772 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
773 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert image"), NULL); | |
774 | |
775 g_signal_connect(G_OBJECT(button), "clicked", | |
776 G_CALLBACK(insert_image_cb), toolbar); | |
777 | |
778 toolbar->image = button; | |
779 | |
780 /* Insert Smiley */ | |
781 button = gaim_pixbuf_toolbar_button_from_stock(GAIM_STOCK_SMILEY); | |
782 gtk_size_group_add_widget(sg, button); | |
783 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
784 gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert smiley"), NULL); | |
785 | |
786 g_signal_connect(G_OBJECT(button), "clicked", | |
787 G_CALLBACK(insert_smiley_cb), toolbar); | |
788 | |
789 toolbar->smiley = button; | |
790 | |
791 | |
792 sep = gtk_hseparator_new(); | |
793 gtk_box_pack_start(GTK_BOX(toolbar), sep, FALSE, FALSE, 0); | |
794 gtk_widget_show(sep); | |
795 | |
796 | |
797 //if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) | |
798 // gtk_widget_hide(vbox); | |
799 | |
800 gtk_widget_show_all(hbox); | |
801 } | |
802 | |
803 GtkWidget *gtk_imhtmltoolbar_new() | |
804 { | |
805 return GTK_WIDGET(g_object_new(gtk_imhtmltoolbar_get_type(), NULL)); | |
806 } | |
807 | |
808 GType gtk_imhtmltoolbar_get_type() | |
809 { | |
810 static GType imhtmltoolbar_type = 0; | |
811 | |
812 if (!imhtmltoolbar_type) { | |
813 static const GTypeInfo imhtmltoolbar_info = { | |
814 sizeof(GtkIMHtmlToolbarClass), | |
815 NULL, | |
816 NULL, | |
817 (GClassInitFunc) gtk_imhtmltoolbar_class_init, | |
818 NULL, | |
819 NULL, | |
820 sizeof (GtkIMHtmlToolbar), | |
821 0, | |
822 (GInstanceInitFunc) gtk_imhtmltoolbar_init | |
823 }; | |
824 | |
8319
a2c5537a814b
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
825 imhtmltoolbar_type = g_type_register_static(GTK_TYPE_VBOX, |
8317 | 826 "GtkIMHtmlToolbar", &imhtmltoolbar_info, 0); |
827 } | |
828 | |
829 return imhtmltoolbar_type; | |
830 } | |
831 | |
832 | |
833 void gtk_imhtmltoolbar_attach (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml) | |
834 { | |
835 toolbar->imhtml = imhtml; | |
836 } |