Sun, 13 Feb 2011 07:38:19 +0000
Whitespace fixes. Try and check your editor settings before writing
tons of code.
| 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" |
|
25922
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
36 | #include "debug.h" |
| 8317 | 37 | |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
38 | #include "gtkdialogs.h" |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
39 | #include "gtkimhtmltoolbar.h" |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
40 | #include "gtksmiley.h" |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11314
diff
changeset
|
41 | #include "gtkthemes.h" |
|
9730
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
42 | #include "gtkutils.h" |
|
e59812364b8b
[gaim-migrate @ 10591]
Mark Doliner <markdoliner@pidgin.im>
parents:
9709
diff
changeset
|
43 | |
|
17394
ebe5e0e583da
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17303
diff
changeset
|
44 | #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
|
45 | |
| 10080 | 46 | static GtkHBoxClass *parent_class = NULL; |
| 8317 | 47 | |
|
11275
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
48 | static void toggle_button_set_active_block(GtkToggleButton *button, |
|
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
49 | gboolean is_active, |
|
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
50 | GtkIMHtmlToolbar *toolbar); |
|
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
51 | |
|
30408
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
52 | static gboolean |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
53 | gtk_imhtmltoolbar_popup_menu(GtkWidget *widget, |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
54 | GdkEventButton *event, GtkIMHtmlToolbar *toolbar); |
|
11275
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
55 | |
| 8317 | 56 | static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar) |
| 57 | { | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
58 | g_return_if_fail(toolbar != NULL); |
| 8317 | 59 | gtk_imhtml_toggle_bold(GTK_IMHTML(toolbar->imhtml)); |
| 60 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 61 | } | |
| 62 | ||
| 63 | static void | |
| 64 | do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar) | |
| 65 | { | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
66 | g_return_if_fail(toolbar != NULL); |
| 8317 | 67 | gtk_imhtml_toggle_italic(GTK_IMHTML(toolbar->imhtml)); |
| 68 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 69 | } | |
| 70 | ||
| 71 | static void | |
| 72 | do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar) | |
| 73 | { | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
74 | g_return_if_fail(toolbar != NULL); |
| 8317 | 75 | gtk_imhtml_toggle_underline(GTK_IMHTML(toolbar->imhtml)); |
| 76 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 77 | } | |
| 78 | ||
| 79 | static void | |
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
80 | do_strikethrough(GtkWidget *strikethrough, GtkIMHtmlToolbar *toolbar) |
|
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 | g_return_if_fail(toolbar != NULL); |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
83 | 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
|
84 | gtk_widget_grab_focus(toolbar->imhtml); |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
85 | } |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
86 | |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
87 | static void |
| 8317 | 88 | do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar) |
| 89 | { | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
90 | 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
|
91 | /* 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
|
92 | 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
|
93 | gtk_imhtml_font_shrink(GTK_IMHTML(toolbar->imhtml)); |
| 8317 | 94 | gtk_widget_grab_focus(toolbar->imhtml); |
| 95 | } | |
| 96 | ||
| 97 | static void | |
| 98 | do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar) | |
| 99 | { | |
| 100 | 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
|
101 | /* 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
|
102 | 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
|
103 | gtk_imhtml_font_grow(GTK_IMHTML(toolbar->imhtml)); |
| 8317 | 104 | gtk_widget_grab_focus(toolbar->imhtml); |
| 105 | } | |
| 106 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
107 | static gboolean |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
108 | destroy_toolbar_font(GtkWidget *widget, GdkEvent *event, |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
109 | GtkIMHtmlToolbar *toolbar) |
| 8317 | 110 | { |
|
10135
760803be53d2
[gaim-migrate @ 11202]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10134
diff
changeset
|
111 | if (widget != NULL) |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
112 | gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), ""); |
| 8317 | 113 | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
114 | if (toolbar->font_dialog != NULL) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
115 | { |
| 8317 | 116 | gtk_widget_destroy(toolbar->font_dialog); |
| 117 | toolbar->font_dialog = NULL; | |
| 118 | } | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
119 | return FALSE; |
| 8317 | 120 | } |
| 121 | ||
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
122 | static void |
| 10125 | 123 | realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
| 124 | { | |
| 125 | GtkFontSelection *sel; | |
| 126 | ||
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
127 | sel = GTK_FONT_SELECTION( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
128 | gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
129 | gtk_widget_hide(gtk_widget_get_parent( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
130 | gtk_font_selection_get_size_entry(sel))); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
131 | gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
132 | gtk_widget_show(gtk_widget_get_parent( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
133 | gtk_font_selection_get_family_list(sel))); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
134 | gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
135 | gtk_font_selection_get_family_list(sel)))); |
| 10125 | 136 | } |
| 137 | ||
| 138 | static void | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
139 | cancel_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
140 | { |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
141 | destroy_toolbar_font(widget, NULL, toolbar); |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
142 | } |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
143 | |
|
28257
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
144 | static void |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
145 | apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) |
| 8317 | 146 | { |
| 147 | /* this could be expanded to include font size, weight, etc. | |
| 148 | but for now only works with font face */ | |
|
28257
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
149 | gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel); |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
150 | GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
151 | "purple_toolbar"); |
| 8317 | 152 | |
|
28257
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
153 | if (fontname) { |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
154 | const gchar *family_name = NULL; |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
155 | PangoFontDescription *desc = NULL; |
| 8317 | 156 | |
|
28257
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
157 | desc = pango_font_description_from_string(fontname); |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
158 | family_name = pango_font_description_get_family(desc); |
| 8317 | 159 | |
|
28257
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
160 | if (family_name) { |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
161 | gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
162 | family_name); |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
163 | } |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
164 | |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
165 | pango_font_description_free(desc); |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
166 | g_free(fontname); |
|
60cee5b2d42e
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <deryni@pidgin.im>
parents:
26828
diff
changeset
|
167 | } |
| 8317 | 168 | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
169 | cancel_toolbar_font(NULL, toolbar); |
| 8317 | 170 | } |
| 171 | ||
| 172 | static void | |
| 173 | toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) | |
| 174 | { | |
| 175 | g_return_if_fail(toolbar); | |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
176 | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
177 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
178 | char *fontname = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml)); |
| 9025 | 179 | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
180 | if (!toolbar->font_dialog) { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
181 | toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); |
| 8317 | 182 | |
| 15884 | 183 | 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
|
184 | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
185 | if(fontname) { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
186 | char *fonttif = g_strdup_printf("%s 12", fontname); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
187 | g_free(fontname); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
188 | 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
|
189 | fonttif); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
190 | g_free(fonttif); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
191 | } else { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
192 | 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
|
193 | DEFAULT_FONT_FACE); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
194 | } |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
195 | |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
196 | g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
197 | G_CALLBACK(destroy_toolbar_font), toolbar); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
198 | g_signal_connect(G_OBJECT( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
199 | gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
200 | "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
201 | g_signal_connect(G_OBJECT( |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
202 | gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
203 | "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
204 | g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
205 | G_CALLBACK(realize_toolbar_font), toolbar); |
| 9025 | 206 | } |
| 8317 | 207 | gtk_window_present(GTK_WINDOW(toolbar->font_dialog)); |
| 208 | } else { | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
209 | cancel_toolbar_font(font, toolbar); |
| 8317 | 210 | } |
| 211 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 212 | } | |
| 213 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
214 | static gboolean |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
215 | destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
216 | GtkIMHtmlToolbar *toolbar) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
217 | { |
|
10135
760803be53d2
[gaim-migrate @ 11202]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10134
diff
changeset
|
218 | if (widget != NULL) |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
219 | gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), ""); |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
220 | |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
221 | if (toolbar->fgcolor_dialog != NULL) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
222 | { |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
223 | gtk_widget_destroy(toolbar->fgcolor_dialog); |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
224 | toolbar->fgcolor_dialog = NULL; |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
225 | } |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
226 | return FALSE; |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
227 | } |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
228 | |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
229 | static void cancel_toolbar_fgcolor(GtkWidget *widget, |
|
8321
477316d4d8a3
[gaim-migrate @ 9045]
Christian Hammond <chipx86@chipx86.com>
parents:
8320
diff
changeset
|
230 | GtkIMHtmlToolbar *toolbar) |
| 8317 | 231 | { |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
232 | destroy_toolbar_fgcolor(widget, NULL, toolbar); |
| 8317 | 233 | } |
| 234 | ||
| 235 | static void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | |
| 236 | { | |
| 237 | GdkColor text_color; | |
| 15884 | 238 | GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); |
| 8317 | 239 | char *open_tag; |
| 240 | ||
| 241 | open_tag = g_malloc(30); | |
| 242 | gtk_color_selection_get_current_color(colorsel, &text_color); | |
| 243 | g_snprintf(open_tag, 23, "#%02X%02X%02X", | |
| 244 | text_color.red / 256, | |
| 245 | text_color.green / 256, | |
| 246 | text_color.blue / 256); | |
| 247 | gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), open_tag); | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
248 | g_free(open_tag); |
| 8317 | 249 | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
250 | cancel_toolbar_fgcolor(NULL, toolbar); |
| 8317 | 251 | } |
| 252 | ||
| 253 | static void | |
| 254 | toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) | |
| 255 | { | |
| 256 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { | |
| 257 | GtkWidget *colorsel; | |
| 9025 | 258 | GdkColor fgcolor; |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10297
diff
changeset
|
259 | 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
|
260 | |
| 8317 | 261 | if (!toolbar->fgcolor_dialog) { |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
262 | GtkWidget *ok_button; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
263 | GtkWidget *cancel_button; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
264 | |
| 8317 | 265 | toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
266 | colorsel = |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
267 | gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); |
| 9025 | 268 | if (color) { |
| 269 | gdk_color_parse(color, &fgcolor); | |
| 270 | 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
|
271 | g_free(color); |
| 9025 | 272 | } |
| 273 | ||
| 15884 | 274 | g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
275 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
276 | g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
277 | g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", &cancel_button, NULL); |
| 8317 | 278 | g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
279 | G_CALLBACK(destroy_toolbar_fgcolor), toolbar); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
280 | g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
281 | g_signal_connect(G_OBJECT(cancel_button), "clicked", |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
282 | G_CALLBACK(cancel_toolbar_fgcolor), toolbar); |
| 8317 | 283 | } |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
284 | gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
285 | } else { |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
286 | cancel_toolbar_fgcolor(color, toolbar); |
| 8317 | 287 | } |
| 288 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 289 | } | |
| 290 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
291 | static gboolean |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
292 | destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
293 | GtkIMHtmlToolbar *toolbar) |
| 8317 | 294 | { |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
295 | if (widget != NULL) { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
296 | 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
|
297 | gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), ""); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
298 | else |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
299 | gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), ""); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
300 | } |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
301 | |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
302 | if (toolbar->bgcolor_dialog != NULL) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
303 | { |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
304 | gtk_widget_destroy(toolbar->bgcolor_dialog); |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
305 | toolbar->bgcolor_dialog = NULL; |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
306 | } |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
307 | return FALSE; |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
308 | } |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
309 | |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
310 | static void |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
311 | cancel_toolbar_bgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
312 | { |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
313 | destroy_toolbar_bgcolor(widget, NULL, toolbar); |
| 8317 | 314 | } |
| 315 | ||
| 316 | static void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | |
| 317 | { | |
| 318 | GdkColor text_color; | |
| 15884 | 319 | GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); |
| 8317 | 320 | char *open_tag; |
| 321 | ||
| 322 | open_tag = g_malloc(30); | |
| 323 | gtk_color_selection_get_current_color(colorsel, &text_color); | |
| 324 | g_snprintf(open_tag, 23, "#%02X%02X%02X", | |
| 325 | text_color.red / 256, | |
| 326 | text_color.green / 256, | |
| 327 | text_color.blue / 256); | |
| 10777 | 328 | if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, NULL, NULL)) |
| 329 | gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), open_tag); | |
| 330 | else | |
| 331 | gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), open_tag); | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
332 | g_free(open_tag); |
| 8317 | 333 | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
334 | cancel_toolbar_bgcolor(NULL, toolbar); |
| 8317 | 335 | } |
| 336 | ||
| 337 | static void | |
| 338 | toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) | |
| 339 | { | |
| 340 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { | |
| 341 | GtkWidget *colorsel; | |
| 9025 | 342 | GdkColor bgcolor; |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10297
diff
changeset
|
343 | 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
|
344 | |
| 8317 | 345 | if (!toolbar->bgcolor_dialog) { |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
346 | GtkWidget *ok_button; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
347 | GtkWidget *cancel_button; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
348 | |
|
8359
3c62ea91eba8
[gaim-migrate @ 9083]
Mark Doliner <markdoliner@pidgin.im>
parents:
8325
diff
changeset
|
349 | toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
350 | colorsel = |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
351 | gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
352 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
353 | if (color) { |
| 9025 | 354 | gdk_color_parse(color, &bgcolor); |
| 355 | 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
|
356 | g_free(color); |
| 9025 | 357 | } |
| 358 | ||
| 15884 | 359 | g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
360 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
361 | g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
362 | g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
363 | &cancel_button, NULL); |
| 8317 | 364 | g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
365 | G_CALLBACK(destroy_toolbar_bgcolor), toolbar); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
366 | g_signal_connect(G_OBJECT(ok_button), "clicked", |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
367 | G_CALLBACK(do_bgcolor), colorsel); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
368 | g_signal_connect(G_OBJECT(cancel_button), "clicked", |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
369 | G_CALLBACK(cancel_toolbar_bgcolor), toolbar); |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
370 | |
| 8317 | 371 | } |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
372 | gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog)); |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
373 | } else { |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
374 | cancel_toolbar_bgcolor(color, toolbar); |
| 8317 | 375 | } |
| 376 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 377 | } | |
| 378 | ||
| 379 | static void | |
|
11271
939be1fdbf7a
[gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents:
11267
diff
changeset
|
380 | clear_formatting_cb(GtkWidget *clear, GtkIMHtmlToolbar *toolbar) |
|
939be1fdbf7a
[gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents:
11267
diff
changeset
|
381 | { |
|
11275
cdcc651d7ecd
[gaim-migrate @ 13461]
Richard Laager <rlaager@pidgin.im>
parents:
11271
diff
changeset
|
382 | 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
|
383 | gtk_imhtml_clear_formatting(GTK_IMHTML(toolbar->imhtml)); |
|
939be1fdbf7a
[gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents:
11267
diff
changeset
|
384 | } |
|
939be1fdbf7a
[gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents:
11267
diff
changeset
|
385 | |
|
939be1fdbf7a
[gaim-migrate @ 13454]
Richard Laager <rlaager@pidgin.im>
parents:
11267
diff
changeset
|
386 | static void |
| 15884 | 387 | cancel_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields) |
| 8317 | 388 | { |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
389 | 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
|
390 | |
| 8317 | 391 | toolbar->link_dialog = NULL; |
| 392 | } | |
| 393 | ||
| 394 | static void | |
| 395 | close_link_dialog(GtkIMHtmlToolbar *toolbar) | |
| 396 | { | |
| 397 | if (toolbar->link_dialog != NULL) | |
| 398 | { | |
| 15884 | 399 | purple_request_close(PURPLE_REQUEST_FIELDS, toolbar->link_dialog); |
| 8317 | 400 | toolbar->link_dialog = NULL; |
| 401 | } | |
| 402 | } | |
| 403 | ||
| 404 | static void | |
| 15884 | 405 | do_insert_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields) |
| 8317 | 406 | { |
| 407 | const char *url, *description; | |
| 408 | ||
| 15884 | 409 | url = purple_request_fields_get_string(fields, "url"); |
| 9041 | 410 | if (GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) |
| 15884 | 411 | description = purple_request_fields_get_string(fields, "description"); |
| 9041 | 412 | else |
| 413 | description = NULL; | |
| 8317 | 414 | |
| 415 | if (description == NULL) | |
| 416 | description = url; | |
| 417 | ||
| 8677 | 418 | gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), |
| 419 | gtk_text_buffer_get_insert(GTK_IMHTML(toolbar->imhtml)->text_buffer), | |
| 420 | url, description); | |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
421 | |
| 8317 | 422 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); |
| 423 | ||
| 424 | toolbar->link_dialog = NULL; | |
| 425 | } | |
| 426 | ||
| 427 | static void | |
| 428 | insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar) | |
| 429 | { | |
| 430 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { | |
| 15884 | 431 | PurpleRequestFields *fields; |
| 432 | PurpleRequestFieldGroup *group; | |
| 433 | PurpleRequestField *field; | |
| 9599 | 434 | GtkTextIter start, end; |
| 9041 | 435 | char *msg; |
| 9599 | 436 | char *desc = NULL; |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
437 | |
| 15884 | 438 | fields = purple_request_fields_new(); |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
439 | |
| 15884 | 440 | group = purple_request_field_group_new(NULL); |
| 441 | purple_request_fields_add_group(fields, group); | |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
442 | |
| 15884 | 443 | field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE); |
| 444 | purple_request_field_set_required(field, TRUE); | |
| 445 | purple_request_field_group_add_field(group, field); | |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
446 | |
| 9041 | 447 | if(GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) { |
| 9599 | 448 | if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, &start, &end)) { |
| 449 | desc = gtk_imhtml_get_text(GTK_IMHTML(toolbar->imhtml), &start, &end); | |
| 450 | } | |
| 15884 | 451 | field = purple_request_field_string_new("description", _("_Description"), |
| 9599 | 452 | desc, FALSE); |
| 15884 | 453 | purple_request_field_group_add_field(group, field); |
| 9041 | 454 | msg = g_strdup(_("Please enter the URL and description of the " |
| 455 | "link that you want to insert. The description " | |
| 456 | "is optional.")); | |
| 457 | } else { | |
| 458 | msg = g_strdup(_("Please enter the URL of the " | |
| 459 | "link that you want to insert.")); | |
| 460 | } | |
|
8319
6c18762beceb
[gaim-migrate @ 9043]
Christian Hammond <chipx86@chipx86.com>
parents:
8317
diff
changeset
|
461 | |
| 8317 | 462 | toolbar->link_dialog = |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
463 | purple_request_fields(toolbar, _("Insert Link"), |
| 8317 | 464 | NULL, |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
465 | msg, |
| 8317 | 466 | fields, |
| 467 | _("_Insert"), G_CALLBACK(do_insert_link_cb), | |
| 468 | _("Cancel"), G_CALLBACK(cancel_link_cb), | |
|
21653
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
469 | NULL, NULL, NULL, |
|
621c47778132
merge of '73ae9aeda3c58fbf8437421da68d19d06f93e686'
Evan Schoenberg <evands@pidgin.im>
parents:
21233
diff
changeset
|
470 | toolbar); |
| 9041 | 471 | g_free(msg); |
| 9599 | 472 | g_free(desc); |
|
8322
9bae68fd2612
[gaim-migrate @ 9046]
Christian Hammond <chipx86@chipx86.com>
parents:
8321
diff
changeset
|
473 | } else { |
| 8317 | 474 | close_link_dialog(toolbar); |
| 475 | } | |
| 476 | gtk_widget_grab_focus(toolbar->imhtml); | |
| 477 | } | |
| 478 | ||
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
479 | 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
|
480 | { |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
481 | GtkTextIter iter; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
482 | GtkTextMark *ins; |
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
483 | GtkIMHtmlScalable *hr; |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
484 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
485 | ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
486 | gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); |
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
487 | hr = gtk_imhtml_hr_new(); |
|
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
488 | 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
|
489 | } |
| 8317 | 490 | |
| 491 | static void | |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
492 | do_insert_image_cb(GtkWidget *widget, int response, GtkIMHtmlToolbar *toolbar) |
| 8317 | 493 | { |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
494 | gchar *filename, *name, *buf; |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
495 | char *filedata; |
| 8317 | 496 | size_t size; |
| 497 | GError *error = NULL; | |
| 498 | int id; | |
| 8962 | 499 | GtkTextIter iter; |
| 500 | GtkTextMark *ins; | |
| 8317 | 501 | |
|
21985
bf0e936998e4
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21954
diff
changeset
|
502 | if (response != GTK_RESPONSE_ACCEPT) |
|
bf0e936998e4
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21954
diff
changeset
|
503 | { |
| 8317 | 504 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
| 505 | return; | |
| 506 | } | |
| 507 | ||
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
508 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); |
| 8317 | 509 | |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
510 | if (filename == NULL) { |
| 8317 | 511 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
| 512 | return; | |
| 513 | } | |
| 514 | ||
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
515 | /* The following triggers a callback that closes the widget */ |
| 8317 | 516 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
| 517 | ||
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
518 | if (!g_file_get_contents(filename, &filedata, &size, &error)) { |
| 15884 | 519 | purple_notify_error(NULL, NULL, error->message, NULL); |
| 8317 | 520 | |
| 521 | g_error_free(error); | |
|
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 | name = strrchr(filename, G_DIR_SEPARATOR) + 1; |
| 8317 | 528 | |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
529 | id = purple_imgstore_add_with_id(filedata, size, name); |
| 8317 | 530 | |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
531 | if (id == 0) { |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
532 | buf = g_strdup_printf(_("Failed to store image: %s\n"), filename); |
| 15884 | 533 | purple_notify_error(NULL, NULL, buf, NULL); |
| 8317 | 534 | |
| 535 | g_free(buf); | |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
536 | g_free(filename); |
| 8317 | 537 | |
| 538 | return; | |
| 539 | } | |
| 540 | ||
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
541 | g_free(filename); |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
542 | |
| 8962 | 543 | ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); |
| 544 | 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
|
545 | &iter, ins); |
| 8962 | 546 | 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
|
547 | purple_imgstore_unref_by_id(id); |
| 8317 | 548 | } |
| 549 | ||
| 550 | ||
| 551 | static void | |
| 552 | insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar) | |
| 553 | { | |
| 554 | GtkWidget *window; | |
| 555 | ||
| 556 | 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
|
557 | window = gtk_file_chooser_dialog_new(_("Insert Image"), |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
558 | NULL, |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
559 | GTK_FILE_CHOOSER_ACTION_OPEN, |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
560 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
561 | GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
562 | NULL); |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
563 | gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
564 | g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), |
|
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
565 | "response", G_CALLBACK(do_insert_image_cb), toolbar); |
| 8317 | 566 | |
| 567 | gtk_widget_show(window); | |
| 568 | toolbar->image_dialog = window; | |
| 569 | } else { | |
| 570 | gtk_widget_destroy(toolbar->image_dialog); | |
| 571 | toolbar->image_dialog = NULL; | |
| 572 | } | |
|
9522
e38381bd8c05
[gaim-migrate @ 10349]
Mark Doliner <markdoliner@pidgin.im>
parents:
9287
diff
changeset
|
573 | |
| 8317 | 574 | gtk_widget_grab_focus(toolbar->imhtml); |
| 575 | } | |
| 576 | ||
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
577 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
578 | static void |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
579 | destroy_smiley_dialog(GtkIMHtmlToolbar *toolbar) |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
580 | { |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
581 | if (toolbar->smiley_dialog != NULL) |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
582 | { |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
583 | gtk_widget_destroy(toolbar->smiley_dialog); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
584 | toolbar->smiley_dialog = NULL; |
| 8317 | 585 | } |
| 586 | } | |
| 587 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21985
diff
changeset
|
588 | static gboolean |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
589 | close_smiley_dialog(GtkIMHtmlToolbar *toolbar) |
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
590 | { |
|
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
591 | 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
|
592 | return FALSE; |
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
593 | } |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
594 | |
| 8317 | 595 | |
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
596 | static void |
|
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
597 | insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
| 8317 | 598 | { |
| 9027 | 599 | char *smiley_text, *escaped_smiley; |
| 600 | ||
| 601 | 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
|
602 | escaped_smiley = g_markup_escape_text(smiley_text, -1); |
| 8317 | 603 | |
| 8456 | 604 | gtk_imhtml_insert_smiley(GTK_IMHTML(toolbar->imhtml), |
| 605 | GTK_IMHTML(toolbar->imhtml)->protocol_name, | |
| 9027 | 606 | escaped_smiley); |
| 8317 | 607 | |
| 9027 | 608 | g_free(escaped_smiley); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
609 | |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
610 | close_smiley_dialog(toolbar); |
| 8317 | 611 | } |
| 612 | ||
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
613 | /* smiley buttons list */ |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
614 | struct smiley_button_list { |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
615 | int width, height; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
616 | GtkWidget *button; |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
617 | const GtkIMHtmlSmiley *smiley; |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
618 | struct smiley_button_list *next; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
619 | }; |
| 8317 | 620 | |
|
11862
5d4bc6d54688
[gaim-migrate @ 14153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11849
diff
changeset
|
621 | static struct smiley_button_list * |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
622 | sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
623 | int *width, const GtkIMHtmlSmiley *smiley) |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
624 | { |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
625 | GtkWidget *image; |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
626 | GtkWidget *button; |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
627 | GtkRequisition size; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
628 | struct smiley_button_list *cur; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
629 | struct smiley_button_list *it, *it_last; |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
630 | const gchar *filename = smiley->file; |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
631 | gchar *face = smiley->smile; |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
632 | PurpleSmiley *psmiley = NULL; |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
633 | gboolean supports_custom = (gtk_imhtml_get_format_functions(GTK_IMHTML(toolbar->imhtml)) & GTK_IMHTML_CUSTOM_SMILEY); |
| 8317 | 634 | |
|
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
|
635 | cur = g_new0(struct smiley_button_list, 1); |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
636 | it = ls; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
637 | it_last = ls; /* list iterators*/ |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
638 | image = gtk_image_new_from_file(filename); |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
639 | |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
640 | gtk_widget_size_request(image, &size); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
641 | |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
642 | if (size.width > 24 && |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
643 | smiley->flags & GTK_IMHTML_SMILEY_CUSTOM) { /* This is a custom smiley, let's scale it */ |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
644 | GdkPixbuf *pixbuf = NULL; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
645 | GtkImageType type; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
646 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
647 | type = gtk_image_get_storage_type(GTK_IMAGE(image)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
648 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
649 | if (type == GTK_IMAGE_PIXBUF) { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
650 | pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); |
|
23009
0bac25fdc9aa
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23008
diff
changeset
|
651 | } else if (type == GTK_IMAGE_ANIMATION) { |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
652 | GdkPixbufAnimation *animation; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
653 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
654 | animation = gtk_image_get_animation(GTK_IMAGE(image)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
655 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
656 | pixbuf = gdk_pixbuf_animation_get_static_image(animation); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
657 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
658 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
659 | if (pixbuf != NULL) { |
|
23009
0bac25fdc9aa
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23008
diff
changeset
|
660 | GdkPixbuf *resized; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
661 | resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
662 | GDK_INTERP_HYPER); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
663 | |
|
23011
33ff8a373a92
A leak fix from malu. Thanks!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23010
diff
changeset
|
664 | gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */ |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
665 | gtk_widget_size_request(image, &size); |
|
23009
0bac25fdc9aa
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23008
diff
changeset
|
666 | g_object_unref(G_OBJECT(resized)); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
667 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
668 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
669 | |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
670 | (*width) += size.width; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
671 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
672 | button = gtk_button_new(); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
673 | gtk_container_add(GTK_CONTAINER(button), image); |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
674 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
675 | g_object_set_data(G_OBJECT(button), "smiley_text", face); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
676 | 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
|
677 | |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
678 | #if GTK_CHECK_VERSION(2,12,0) |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
679 | gtk_widget_set_tooltip_text(button, face); |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
680 | #else |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
681 | gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
682 | #endif |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
683 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
684 | /* these look really weird with borders */ |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
685 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
686 | |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
687 | psmiley = purple_smileys_find_by_shortcut(smiley->smile); |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
688 | /* If this is a "non-custom" smiley, check to see if its shortcut is |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
689 | "shadowed" by any custom smiley. This can only happen if the connection |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
690 | is custom smiley-enabled */ |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
691 | if (supports_custom && psmiley && !(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) { |
|
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
692 | gchar tip[128]; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24275
diff
changeset
|
693 | g_snprintf(tip, sizeof(tip), |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
694 | _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), |
|
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
695 | face); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
696 | #if GTK_CHECK_VERSION(2,12,0) |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
697 | gtk_widget_set_tooltip_text(button, tip); |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
698 | #else |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
699 | gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
700 | #endif |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
701 | gtk_widget_set_sensitive(button, FALSE); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
702 | } else if (psmiley) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
703 | /* Remove the button if the smiley is destroyed */ |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
704 | g_signal_connect_object(G_OBJECT(psmiley), "destroy", G_CALLBACK(gtk_widget_destroy), |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
705 | button, G_CONNECT_SWAPPED); |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
706 | } |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
707 | |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
708 | /* set current element to add */ |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
709 | cur->height = size.height; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
710 | cur->width = size.width; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
711 | cur->button = button; |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
712 | cur->smiley = smiley; |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
713 | cur->next = ls; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
714 | |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
715 | /* check where to insert by height */ |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
716 | if (ls == NULL) |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
717 | return cur; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
718 | while (it != NULL) { |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
719 | it_last = it; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
720 | it = it->next; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
721 | } |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
722 | cur->next = it; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
723 | it_last->next = cur; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
724 | return ls; |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
725 | } |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
726 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
727 | static gboolean |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
728 | smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
729 | { |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
730 | while (list) { |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
731 | GtkIMHtmlSmiley *cur = (GtkIMHtmlSmiley *) list->data; |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
732 | if (!strcmp(cur->file, smiley->file)) |
| 8317 | 733 | return FALSE; |
| 734 | list = list->next; | |
| 735 | } | |
| 736 | return TRUE; | |
| 737 | } | |
| 738 | ||
|
17394
ebe5e0e583da
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17303
diff
changeset
|
739 | static gboolean |
|
ebe5e0e583da
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17303
diff
changeset
|
740 | 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
|
741 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
742 | if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || |
|
18546
3515b5b454e9
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents:
18545
diff
changeset
|
743 | (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
|
744 | { |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
745 | close_smiley_dialog(toolbar); |
|
18546
3515b5b454e9
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents:
18545
diff
changeset
|
746 | return TRUE; |
|
3515b5b454e9
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents:
18545
diff
changeset
|
747 | } |
|
17394
ebe5e0e583da
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17303
diff
changeset
|
748 | |
|
18546
3515b5b454e9
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@pidgin.im>
parents:
18545
diff
changeset
|
749 | return FALSE; |
|
17394
ebe5e0e583da
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17303
diff
changeset
|
750 | } |
| 8317 | 751 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
752 | static void |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
753 | add_smiley_list(GtkWidget *container, struct smiley_button_list *list, |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
754 | int max_width, gboolean custom) |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
755 | { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
756 | GtkWidget *line; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
757 | int line_width = 0; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
758 | |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
759 | if (!list) |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
760 | return; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
761 | |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
762 | line = gtk_hbox_new(FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
763 | gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
764 | for (; list; list = list->next) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
765 | if (custom != !!(list->smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
766 | continue; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
767 | gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
768 | gtk_widget_show(list->button); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
769 | line_width += list->width; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
770 | if (line_width >= max_width) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
771 | if (list->next) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
772 | line = gtk_hbox_new(FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
773 | gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
774 | } |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
775 | line_width = 0; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
776 | } |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
777 | } |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
778 | } |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
779 | |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
780 | static void |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
781 | insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
782 | { |
|
23296
7f870792ce29
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23289
diff
changeset
|
783 | GtkWidget *dialog, *vbox; |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
784 | GtkWidget *smiley_table = NULL; |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
785 | GSList *smileys, *unique_smileys = NULL; |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
786 | const GSList *custom_smileys = NULL; |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
787 | gboolean supports_custom = FALSE; |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
788 | GtkRequisition req; |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
789 | GtkWidget *scrolled, *viewport; |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
790 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
791 | if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
792 | destroy_smiley_dialog(toolbar); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
793 | gtk_widget_grab_focus(toolbar->imhtml); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
794 | return; |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
795 | } |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
796 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
797 | 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
|
798 | smileys = pidgin_themes_get_proto_smileys(toolbar->sml); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
799 | 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
|
800 | smileys = pidgin_themes_get_proto_smileys(NULL); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
801 | |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
802 | /* Note: prepend smileys to list to avoid O(n^2) overhead when there is |
|
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
803 | a large number of smileys... need to revers the list after for the dialog |
|
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
804 | work... */ |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
805 | while(smileys) { |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
806 | GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) smileys->data; |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
807 | if(!smiley->hidden) { |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
808 | if(smiley_is_unique(unique_smileys, smiley)) { |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
809 | unique_smileys = g_slist_prepend(unique_smileys, smiley); |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
810 | } |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
811 | } |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
812 | smileys = smileys->next; |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
813 | } |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
814 | supports_custom = (gtk_imhtml_get_format_functions(GTK_IMHTML(toolbar->imhtml)) & GTK_IMHTML_CUSTOM_SMILEY); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
815 | if (toolbar->imhtml && supports_custom) { |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
816 | const GSList *iterator = NULL; |
|
23010
6230fac29cee
Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
817 | custom_smileys = pidgin_smileys_get_all(); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
818 | |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
819 | for (iterator = custom_smileys ; iterator ; |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
820 | iterator = g_slist_next(iterator)) { |
|
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
821 | GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) iterator->data; |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
822 | unique_smileys = g_slist_prepend(unique_smileys, smiley); |
|
23010
6230fac29cee
Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
823 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22218
diff
changeset
|
824 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24275
diff
changeset
|
825 | |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
826 | /* we need to reverse the list to get the smileys in the correct order */ |
|
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
827 | unique_smileys = g_slist_reverse(unique_smileys); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
828 | |
|
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
|
829 | dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
830 | gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
|
23296
7f870792ce29
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23289
diff
changeset
|
831 | vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, 0); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
832 | |
|
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
|
833 | if (unique_smileys != NULL) { |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
834 | struct smiley_button_list *ls; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
835 | int max_line_width, num_lines, button_width = 0; |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
836 | |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
837 | /* We use hboxes packed in a vbox */ |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
838 | ls = NULL; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
839 | max_line_width = 0; |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
840 | num_lines = floor(sqrt(g_slist_length(unique_smileys))); |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
841 | smiley_table = gtk_vbox_new(FALSE, 0); |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
842 | |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
843 | if (supports_custom) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
844 | GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys")); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
845 | GtkRequisition req; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
846 | g_signal_connect(G_OBJECT(manage), "clicked", |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
847 | G_CALLBACK(pidgin_smiley_manager_show), NULL); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
848 | g_signal_connect_swapped(G_OBJECT(manage), "clicked", |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
849 | G_CALLBACK(gtk_widget_destroy), dialog); |
|
23296
7f870792ce29
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23289
diff
changeset
|
850 | gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0); |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
851 | gtk_widget_size_request(manage, &req); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
852 | button_width = req.width; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
853 | } |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
854 | |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
855 | /* create list of smileys sorted by height */ |
|
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
856 | while (unique_smileys) { |
|
23014
d406337e359a
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23011
diff
changeset
|
857 | GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) unique_smileys->data; |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
858 | if (!smiley->hidden) { |
|
23484
8ee3e86bfdca
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <malu@pidgin.im>
parents:
23368
diff
changeset
|
859 | ls = sort_smileys(ls, toolbar, &max_line_width, smiley); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
860 | } |
|
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
|
861 | unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
862 | } |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
863 | /* The window will be at least as wide as the 'Manage ..' button */ |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
864 | max_line_width = MAX(button_width, max_line_width / num_lines); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
865 | |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
866 | /* pack buttons of the list */ |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
867 | add_smiley_list(smiley_table, ls, max_line_width, FALSE); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
868 | if (supports_custom) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
869 | gtk_box_pack_start(GTK_BOX(smiley_table), gtk_hseparator_new(), TRUE, FALSE, 0); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
870 | add_smiley_list(smiley_table, ls, max_line_width, TRUE); |
|
10894
b75b237a1212
[gaim-migrate @ 12608]
Benjamin Canou <bookeldor@gmail.com>
parents:
10814
diff
changeset
|
871 | } |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
872 | while (ls) { |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
873 | struct smiley_button_list *tmp = ls->next; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
874 | g_free(ls); |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
875 | ls = tmp; |
|
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
876 | } |
|
18547
cb6e8c0a08ca
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents:
18546
diff
changeset
|
877 | |
|
cb6e8c0a08ca
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@pidgin.im>
parents:
18546
diff
changeset
|
878 | gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
879 | } |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
880 | else { |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
881 | 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
|
882 | 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
|
883 | 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
|
884 | } |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
885 | |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
886 | scrolled = gtk_scrolled_window_new (NULL, NULL); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
887 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_NONE); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
888 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
889 | GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
|
23296
7f870792ce29
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23289
diff
changeset
|
890 | gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
891 | gtk_widget_show(scrolled); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
892 | |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
893 | gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), smiley_table); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
894 | gtk_widget_show(smiley_table); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
895 | |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
896 | viewport = gtk_widget_get_parent(smiley_table); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
897 | gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
898 | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
899 | /* connect signals */ |
|
23016
6cdca784716b
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23015
diff
changeset
|
900 | g_signal_connect_swapped(G_OBJECT(dialog), "destroy", G_CALLBACK(close_smiley_dialog), toolbar); |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
901 | g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(smiley_dialog_input_cb), toolbar); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
902 | |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
903 | gtk_window_set_transient_for(GTK_WINDOW(dialog), |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
904 | GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar)))); |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
905 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
906 | /* show everything */ |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
907 | gtk_widget_show_all(dialog); |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
908 | |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
909 | gtk_widget_size_request(viewport, &req); |
|
23296
7f870792ce29
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23289
diff
changeset
|
910 | gtk_widget_set_size_request(scrolled, MIN(300, req.width), MIN(290, req.height)); |
|
23019
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
911 | |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
912 | /* The window has to be made resizable, and the scrollbars in the scrolled window |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
913 | * enabled only after setting the desired size of the window. If we do either of |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
914 | * these tasks before now, GTK+ miscalculates the required size, and erronously |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
915 | * makes one or both scrollbars visible (sometimes). |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
916 | * I too think this hack is gross. But I couldn't find a better way -- sadrul */ |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
917 | gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
918 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
919 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
|
427ce09896f8
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23016
diff
changeset
|
920 | |
|
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
|
921 | #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
|
922 | 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
|
923 | #endif |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
924 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
925 | toolbar->smiley_dialog = dialog; |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
926 | |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
927 | gtk_widget_grab_focus(toolbar->imhtml); |
|
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
928 | } |
| 8317 | 929 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
930 | static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
931 | { |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
932 | PurpleConversation *conv = |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
933 | g_object_get_data(G_OBJECT(toolbar), "active_conv"); |
|
25922
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
934 | const gchar *who = purple_conversation_get_name(conv); |
|
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
935 | PurpleConnection *gc = purple_conversation_get_gc(conv); |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
936 | |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
937 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); |
|
25922
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
938 | purple_prpl_send_attention(gc, who, 0); |
|
30421
043e250a4339
pidgin: Re-set focus after clicking on the attention button.
Marcus Lundblad <malu@pidgin.im>
parents:
30408
diff
changeset
|
939 | gtk_widget_grab_focus(toolbar->imhtml); |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
940 | } |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
941 | |
| 8420 | 942 | static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
| 943 | { | |
| 944 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_IMHTML_BOLD); | |
| 945 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->italic), buttons & GTK_IMHTML_ITALIC); | |
| 946 | 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
|
947 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->strikethrough), buttons & GTK_IMHTML_STRIKE); |
| 8420 | 948 | |
| 949 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->larger_size), buttons & GTK_IMHTML_GROW); | |
| 950 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smaller_size), buttons & GTK_IMHTML_SHRINK); | |
| 951 | ||
| 952 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->font), buttons & GTK_IMHTML_FACE); | |
| 953 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->fgcolor), buttons & GTK_IMHTML_FORECOLOR); | |
| 954 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bgcolor), buttons & GTK_IMHTML_BACKCOLOR); | |
| 955 | ||
|
11314
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
956 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->clear), |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
957 | (buttons & GTK_IMHTML_BOLD || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
958 | buttons & GTK_IMHTML_ITALIC || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
959 | 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
|
960 | buttons & GTK_IMHTML_STRIKE || |
|
11314
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
961 | buttons & GTK_IMHTML_GROW || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
962 | buttons & GTK_IMHTML_SHRINK || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
963 | buttons & GTK_IMHTML_FACE || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
964 | buttons & GTK_IMHTML_FORECOLOR || |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
965 | buttons & GTK_IMHTML_BACKCOLOR)); |
|
50888518c108
[gaim-migrate @ 13516]
Luke Schierer <lschiere@pidgin.im>
parents:
11313
diff
changeset
|
966 | |
| 8420 | 967 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->image), buttons & GTK_IMHTML_IMAGE); |
| 968 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->link), buttons & GTK_IMHTML_LINK); | |
| 969 | gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smiley), buttons & GTK_IMHTML_SMILEY); | |
| 8481 | 970 | } |
| 8420 | 971 | |
| 8481 | 972 | /* we call this when we want to _set_active the toggle button, it'll |
| 973 | * block the callback thats connected to the button so we don't have to | |
| 974 | * do the double toggling hack | |
| 975 | */ | |
| 976 | static void toggle_button_set_active_block(GtkToggleButton *button, | |
| 977 | gboolean is_active, | |
| 978 | GtkIMHtmlToolbar *toolbar) | |
| 979 | { | |
| 980 | GObject *object; | |
| 981 | g_return_if_fail(toolbar); | |
| 982 | ||
| 983 | object = g_object_ref(button); | |
| 984 | g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, | |
| 985 | 0, 0, NULL, NULL, toolbar); | |
| 986 | gtk_toggle_button_set_active(button, is_active); | |
| 987 | g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, | |
| 988 | 0, 0, NULL, NULL, toolbar); | |
| 989 | g_object_unref(object); | |
| 8420 | 990 | } |
| 991 | ||
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
992 | 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
|
993 | { |
|
19719
446e97aca498
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19647
diff
changeset
|
994 | gboolean bold, italic, underline, strike; |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
995 | char *tmp; |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
996 | char *tmp2; |
|
19068
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
997 | 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
|
998 | |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
999 | gtk_label_set_label(label, _("_Font")); |
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1000 | |
| 8516 | 1001 | gtk_imhtml_get_current_format(GTK_IMHTML(toolbar->imhtml), |
| 1002 | &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
|
1003 | strike = GTK_IMHTML(toolbar->imhtml)->edit.strike; |
| 8506 | 1004 | |
| 1005 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold) | |
| 1006 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold, | |
| 1007 | toolbar); | |
| 1008 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic) | |
| 1009 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic, | |
| 1010 | toolbar); | |
| 1011 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->underline)) != underline) | |
| 1012 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->underline), | |
| 8677 | 1013 | 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
|
1014 | 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
|
1015 | 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
|
1016 | strike, toolbar); |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1017 | |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1018 | /* These buttons aren't ever "active". */ |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1019 | 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
|
1020 | 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
|
1021 | |
|
19068
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1022 | if (bold) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1023 | 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
|
1024 | 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
|
1025 | 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
|
1026 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1027 | } |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1028 | if (italic) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1029 | 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
|
1030 | 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
|
1031 | 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
|
1032 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1033 | } |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1034 | if (underline) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1035 | 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
|
1036 | 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
|
1037 | 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
|
1038 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1039 | } |
|
19719
446e97aca498
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19647
diff
changeset
|
1040 | if (strike) { |
|
446e97aca498
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19647
diff
changeset
|
1041 | 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
|
1042 | 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
|
1043 | 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
|
1044 | 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
|
1045 | } |
|
19068
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1046 | |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1047 | tmp = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml)); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1048 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font), |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1049 | (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
|
1050 | if (tmp != NULL) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1051 | 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
|
1052 | 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
|
1053 | 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
|
1054 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1055 | } |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1056 | g_free(tmp); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1057 | |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1058 | tmp = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1059 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor), |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1060 | (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
|
1061 | if (tmp != NULL) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1062 | 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
|
1063 | 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
|
1064 | 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
|
1065 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1066 | } |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1067 | g_free(tmp); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1068 | |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1069 | tmp = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1070 | tmp2 = gtk_imhtml_get_current_background(GTK_IMHTML(toolbar->imhtml)); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1071 | toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor), |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1072 | (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
|
1073 | if (tmp != NULL) { |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1074 | 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
|
1075 | 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
|
1076 | 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
|
1077 | g_free(markup); |
|
4effc374e407
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@pidgin.im>
parents:
19061
diff
changeset
|
1078 | } |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1079 | g_free(tmp); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1080 | g_free(tmp2); |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1081 | } |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1082 | |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1083 | static void toggle_button_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1084 | { |
|
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1085 | update_buttons(toolbar); |
| 8506 | 1086 | } |
| 8481 | 1087 | |
| 8516 | 1088 | static void update_format_cb(GtkIMHtml *imhtml, GtkIMHtmlToolbar *toolbar) { |
| 1089 | update_buttons(toolbar); | |
| 1090 | } | |
| 8481 | 1091 | |
| 8516 | 1092 | static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, |
| 1093 | GtkTextMark *mark, GtkIMHtmlToolbar *toolbar) | |
| 1094 | { | |
| 1095 | if(mark != gtk_text_buffer_get_insert(buffer)) | |
| 1096 | return; | |
| 1097 | ||
| 1098 | update_buttons(toolbar); | |
| 8427 | 1099 | } |
| 1100 | ||
|
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
|
1101 | |
|
9e21b4e8a98d
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@pidgin.im>
parents:
17403
diff
changeset
|
1102 | /* 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
|
1103 | * 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
|
1104 | * 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
|
1105 | */ |
|
17523
d26a1a21ea72
Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17498
diff
changeset
|
1106 | 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
|
1107 | 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
|
1108 | 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
|
1109 | 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
|
1110 | gboolean *push_in, |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1111 | 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
|
1112 | { |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1113 | 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
|
1114 | GtkRequisition menu_req; |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
1115 | GtkAllocation allocation; |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
1116 | gint ythickness = gtk_widget_get_style(widget)->ythickness; |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1117 | 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
|
1118 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
1119 | gtk_widget_get_allocation(widget, &allocation); |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1120 | gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1121 | gdk_window_get_origin(gtk_widget_get_window(widget), x, y); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1122 | *x += allocation.x; |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1123 | *y += allocation.y + allocation.height; |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1124 | 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
|
1125 | |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1126 | 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
|
1127 | |
|
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18185
diff
changeset
|
1128 | if (savy > *y + ythickness + 1) |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1129 | *y -= 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
|
1130 | } |
|
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
|
1131 | |
|
30408
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1132 | static gboolean |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1133 | button_activate_on_click(GtkWidget *button, GdkEventButton *event, GtkIMHtmlToolbar *toolbar) |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1134 | { |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1135 | if (event->button == 1 && GTK_IS_TOGGLE_BUTTON(button)) |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1136 | gtk_widget_activate(button); |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1137 | else if (event->button == 3) |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1138 | return gtk_imhtmltoolbar_popup_menu(button, event, toolbar); |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1139 | return FALSE; |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1140 | } |
|
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1141 | |
|
19213
e273393f4b75
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19199
diff
changeset
|
1142 | 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
|
1143 | { |
|
19104
35cd69038e67
show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@pidgin.im>
parents:
19089
diff
changeset
|
1144 | 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
|
1145 | 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
|
1146 | } |
|
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
|
1147 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1148 | 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
|
1149 | { |
|
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
|
1150 | 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
|
1151 | } |
|
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
|
1152 | |
| 8317 | 1153 | enum { |
| 1154 | LAST_SIGNAL | |
| 1155 | }; | |
|
9863
323e4fe28791
[gaim-migrate @ 10742]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
1156 | /* static guint signals [LAST_SIGNAL] = { 0 }; */ |
| 8317 | 1157 | |
| 1158 | static void | |
| 1159 | gtk_imhtmltoolbar_finalize (GObject *object) | |
| 1160 | { | |
|
8391
ed3b9c27d002
[gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents:
8380
diff
changeset
|
1161 | 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
|
1162 | GtkWidget *menu; |
| 8317 | 1163 | |
| 8685 | 1164 | if (toolbar->image_dialog != NULL) |
| 1165 | { | |
| 1166 | gtk_widget_destroy(toolbar->image_dialog); | |
| 1167 | toolbar->image_dialog = NULL; | |
| 1168 | } | |
| 1169 | ||
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1170 | destroy_toolbar_font(NULL, NULL, toolbar); |
|
23368
76fd0254bae3
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <datallah@pidgin.im>
parents:
23296
diff
changeset
|
1171 | if (toolbar->smiley_dialog != NULL) { |
|
76fd0254bae3
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <datallah@pidgin.im>
parents:
23296
diff
changeset
|
1172 | g_signal_handlers_disconnect_by_func(G_OBJECT(toolbar->smiley_dialog), close_smiley_dialog, toolbar); |
|
76fd0254bae3
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <datallah@pidgin.im>
parents:
23296
diff
changeset
|
1173 | destroy_smiley_dialog(toolbar); |
|
76fd0254bae3
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <datallah@pidgin.im>
parents:
23296
diff
changeset
|
1174 | } |
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1175 | destroy_toolbar_bgcolor(NULL, NULL, toolbar); |
|
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1176 | destroy_toolbar_fgcolor(NULL, NULL, toolbar); |
|
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1177 | close_link_dialog(toolbar); |
|
12904
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1178 | if (toolbar->imhtml) { |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1179 | g_signal_handlers_disconnect_matched(toolbar->imhtml, |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1180 | G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1181 | toolbar); |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1182 | 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
|
1183 | G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1184 | toolbar); |
|
f01835b6bcac
[gaim-migrate @ 15257]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12900
diff
changeset
|
1185 | } |
| 8784 | 1186 | |
|
24275
37fca4e63b69
Use the correct free() function.
Daniel Atallah <datallah@pidgin.im>
parents:
23532
diff
changeset
|
1187 | g_free(toolbar->sml); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1188 | #if !GTK_CHECK_VERSION(2,12,0) |
|
8391
ed3b9c27d002
[gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents:
8380
diff
changeset
|
1189 | gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1190 | #endif |
| 8317 | 1191 | |
|
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
|
1192 | 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
|
1193 | 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
|
1194 | 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
|
1195 | 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
|
1196 | 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
|
1197 | 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
|
1198 | |
|
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
|
1199 | 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
|
1200 | |
|
8391
ed3b9c27d002
[gaim-migrate @ 9120]
Mark Doliner <markdoliner@pidgin.im>
parents:
8380
diff
changeset
|
1201 | G_OBJECT_CLASS(parent_class)->finalize (object); |
| 8317 | 1202 | } |
| 1203 | ||
|
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
|
1204 | 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
|
1205 | switch_toolbar_view(GtkWidget *item, GtkIMHtmlToolbar *toolbar) |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1206 | { |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1207 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1208 | !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide")); |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1209 | } |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1210 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1211 | 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
|
1212 | 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
|
1213 | { |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1214 | 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
|
1215 | 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
|
1216 | 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
|
1217 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1218 | 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
|
1219 | 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
|
1220 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1221 | wide = gtk_widget_get_visible(toolbar->bold); |
|
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
|
1222 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1223 | 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
|
1224 | item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1225 | g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar); |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1226 | 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
|
1227 | 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
|
1228 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1229 | 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
|
1230 | 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
|
1231 | 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
|
1232 | } |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1233 | |
|
10814
7e17cb56b019
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10777
diff
changeset
|
1234 | /* Boring GTK+ stuff */ |
| 8317 | 1235 | static void gtk_imhtmltoolbar_class_init (GtkIMHtmlToolbarClass *class) |
| 1236 | { | |
| 1237 | GObjectClass *gobject_class; | |
| 1238 | gobject_class = (GObjectClass*) class; | |
|
26828
ca76e7ad0d4b
Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1239 | parent_class = g_type_class_ref(GTK_TYPE_HBOX); |
| 8317 | 1240 | 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
|
1241 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1242 | 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
|
1243 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", FALSE); |
| 8317 | 1244 | } |
| 1245 | ||
|
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
|
1246 | 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
|
1247 | { |
|
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
|
1248 | 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
|
1249 | 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
|
1250 | 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
|
1251 | 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
|
1252 | 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
|
1253 | 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
|
1254 | 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
|
1255 | } 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
|
1256 | {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
|
1257 | {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
|
1258 | {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
|
1259 | {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
|
1260 | {"", 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
|
1261 | {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
|
1262 | {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
|
1263 | {"", 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
|
1264 | {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &toolbar->font, _("Font Face")}, |
|
28258
ec6dd456b74c
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <deryni@pidgin.im>
parents:
28257
diff
changeset
|
1265 | {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, |
|
21954
ffb38ad2e4d6
Patch from DHowett to fix the transposition of background and forebround colors
Sean Egan <seanegan@pidgin.im>
parents:
21888
diff
changeset
|
1266 | {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &toolbar->bgcolor, _("Background 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
|
1267 | {"", 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
|
1268 | {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
|
1269 | {"", NULL, NULL, NULL}, |
|
28258
ec6dd456b74c
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <deryni@pidgin.im>
parents:
28257
diff
changeset
|
1270 | {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, |
|
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
|
1271 | {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, |
|
28258
ec6dd456b74c
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <deryni@pidgin.im>
parents:
28257
diff
changeset
|
1272 | {"", NULL, NULL, NULL}, |
|
19761
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1273 | {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
|
1274 | {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
|
1275 | }; |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1276 | 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
|
1277 | |
|
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
|
1278 | 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
|
1279 | |
|
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
|
1280 | 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
|
1281 | 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
|
1282 | button = pidgin_pixbuf_toolbar_button_from_stock(buttons[iter].stock); |
|
31309
eea56be9e0eb
Fix clicking on buttons in formatting toolbar so they don't try (and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
31294
diff
changeset
|
1283 | g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), 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
|
1284 | 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
|
1285 | 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
|
1286 | *(buttons[iter].button) = button; |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1287 | #if GTK_CHECK_VERSION(2,12,0) |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1288 | gtk_widget_set_tooltip_text(button, buttons[iter].tooltip); |
|
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1289 | #else |
|
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
|
1290 | gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1291 | #endif |
|
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
|
1292 | } 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
|
1293 | 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
|
1294 | 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
|
1295 | } |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1296 | /* create the attention button (this is a bit hacky to not break ABI) */ |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1297 | button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION); |
|
31309
eea56be9e0eb
Fix clicking on buttons in formatting toolbar so they don't try (and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
31294
diff
changeset
|
1298 | g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1299 | g_signal_connect(G_OBJECT(button), "clicked", |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1300 | G_CALLBACK(send_attention_cb), toolbar); |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1301 | g_object_set_data(G_OBJECT(toolbar), "attention", button); |
|
32383
f63e66bd0b02
Fix some additional tooltip calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32380
diff
changeset
|
1302 | #if GTK_CHECK_VERSION(2,12,0) |
|
f63e66bd0b02
Fix some additional tooltip calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32380
diff
changeset
|
1303 | gtk_widget_set_tooltip_text(button, _("Send Attention")); |
|
f63e66bd0b02
Fix some additional tooltip calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32380
diff
changeset
|
1304 | #else |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1305 | gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); |
|
32383
f63e66bd0b02
Fix some additional tooltip calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32380
diff
changeset
|
1306 | #endif |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1307 | gtk_box_pack_start(GTK_BOX(hbox), 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
|
1308 | |
|
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
|
1309 | 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
|
1310 | 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
|
1311 | } |
|
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
|
1312 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1313 | static void |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1314 | button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1315 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1316 | if (gtk_widget_get_visible(button)) |
|
30489
1ce0f6617b57
Did I mention this is entirely untested? (I don't have GTK+ on
Paul Aurich <darkrain42@pidgin.im>
parents:
30488
diff
changeset
|
1317 | gtk_widget_hide(item); |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1318 | else |
|
30489
1ce0f6617b57
Did I mention this is entirely untested? (I don't have GTK+ on
Paul Aurich <darkrain42@pidgin.im>
parents:
30488
diff
changeset
|
1319 | gtk_widget_show(item); |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1320 | } |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1321 | |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1322 | static void |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1323 | 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
|
1324 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1325 | gtk_widget_set_sensitive(item, gtk_widget_get_sensitive(button)); |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1326 | } |
|
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
|
1327 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1328 | static void |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1329 | 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
|
1330 | { |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1331 | 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
|
1332 | 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
|
1333 | 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
|
1334 | } |
|
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
|
1335 | |
|
19199
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1336 | static void |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1337 | enable_markup(GtkWidget *widget, gpointer null) |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1338 | { |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1339 | if (GTK_IS_LABEL(widget)) |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1340 | 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
|
1341 | } |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1342 | |
|
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
|
1343 | 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
|
1344 | 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
|
1345 | 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
|
1346 | { |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1347 | if (value) { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1348 | gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "lean-view")); |
|
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
|
1349 | 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
|
1350 | } else { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1351 | gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "wide-view")); |
|
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
|
1352 | 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
|
1353 | } |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1354 | } |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1355 | |
| 8317 | 1356 | static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) |
| 1357 | { | |
|
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
|
1358 | 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
|
1359 | 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
|
1360 | 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
|
1361 | 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
|
1362 | 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
|
1363 | 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
|
1364 | GtkWidget *smiley_button; |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1365 | GtkWidget *attention_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
|
1366 | 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
|
1367 | 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
|
1368 | GtkWidget *menuitem; |
| 8317 | 1369 | GtkWidget *sep; |
|
30485
32ab27272f37
Use a helper variable to (vastly, to me) improve readability.
Paul Aurich <darkrain42@pidgin.im>
parents:
30423
diff
changeset
|
1370 | GObject *wide_attention_button; |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1371 | int i; |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1372 | struct { |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1373 | const char *label; |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1374 | GtkWidget **button; |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1375 | gboolean check; |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1376 | } buttons[] = { |
|
19199
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1377 | {_("<b>_Bold</b>"), &toolbar->bold, TRUE}, |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1378 | {_("<i>_Italic</i>"), &toolbar->italic, TRUE}, |
|
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1379 | {_("<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
|
1380 | {_("<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
|
1381 | {_("<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
|
1382 | #if 0 |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1383 | {_("_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
|
1384 | #endif |
|
19199
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1385 | {_("<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
|
1386 | /* 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
|
1387 | * 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
|
1388 | * no updating nor nothin' */ |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1389 | {_("_Font face"), &toolbar->font, TRUE}, |
|
19083
14edbc247c42
I thought I fixed this already...
Kevin Stange <kstange@pidgin.im>
parents:
19076
diff
changeset
|
1390 | {_("Foreground _color"), &toolbar->fgcolor, TRUE}, |
|
19084
15f91e441bfb
Another mnemonic conflict
Kevin Stange <kstange@pidgin.im>
parents:
19083
diff
changeset
|
1391 | {_("Bac_kground color"), &toolbar->bgcolor, TRUE}, |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1392 | {_("_Reset formatting"), &toolbar->clear, FALSE}, |
|
19088
8eb73fcef3ad
Get rid of two minor compile warnings:
Mark Doliner <markdoliner@pidgin.im>
parents:
19076
diff
changeset
|
1393 | {NULL, NULL, FALSE} |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1394 | }; |
|
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1395 | |
| 8317 | 1396 | toolbar->imhtml = NULL; |
| 1397 | toolbar->font_dialog = NULL; | |
| 1398 | toolbar->fgcolor_dialog = NULL; | |
| 1399 | toolbar->bgcolor_dialog = NULL; | |
| 1400 | toolbar->link_dialog = NULL; | |
|
10138
b72c5fdc98b3
[gaim-migrate @ 11208]
Mark Doliner <markdoliner@pidgin.im>
parents:
10135
diff
changeset
|
1401 | toolbar->smiley_dialog = NULL; |
| 8317 | 1402 | toolbar->image_dialog = NULL; |
| 1403 | ||
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1404 | #if !GTK_CHECK_VERSION(2,12,0) |
| 8317 | 1405 | toolbar->tooltips = gtk_tooltips_new(); |
|
26929
2a8ade936729
Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26482
diff
changeset
|
1406 | #endif |
|
10134
ecbf96117857
[gaim-migrate @ 11198]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10125
diff
changeset
|
1407 | |
|
17303
138cbb17e5cd
disapproval of revision '6e8f285962e77199bf88dfc8d2a08386beb02634'
Sean Egan <seanegan@pidgin.im>
parents:
17300
diff
changeset
|
1408 | 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
|
1409 | |
|
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
|
1410 | gtk_imhtmltoolbar_create_old_buttons(toolbar); |
| 8317 | 1411 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1412 | /* 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
|
1413 | 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
|
1414 | 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
|
1415 | 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
|
1416 | 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
|
1417 | 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
|
1418 | 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
|
1419 | 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
|
1420 | 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
|
1421 | 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
|
1422 | 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
|
1423 | 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
|
1424 | gtk_widget_show_all(font_button); |
| 8317 | 1425 | |
|
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
|
1426 | 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
|
1427 | g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu); |
|
17879
3e3f85138f1a
merge of '87854ccfae544467c988edbac854c1ae2018eed4'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
1428 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1429 | 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
|
1430 | GtkWidget *old = *buttons[i].button; |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1431 | if (buttons[i].check) { |
|
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1432 | 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
|
1433 | g_signal_connect_after(G_OBJECT(old), "toggled", |
|
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1434 | G_CALLBACK(update_menuitem), menuitem); |
|
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1435 | } else { |
|
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1436 | 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
|
1437 | } |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1438 | 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
|
1439 | 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
|
1440 | 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
|
1441 | 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
|
1442 | G_CALLBACK(button_sensitiveness_changed), menuitem); |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1443 | g_signal_connect(G_OBJECT(old), "notify::visible", |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1444 | G_CALLBACK(button_visibility_changed), menuitem); |
|
19199
f06d090eedab
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19104
diff
changeset
|
1445 | 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
|
1446 | } |
|
19076
84216ea8ddbf
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@pidgin.im>
parents:
19073
diff
changeset
|
1447 | |
|
30408
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1448 | g_signal_connect(G_OBJECT(font_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); |
|
19213
e273393f4b75
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19199
diff
changeset
|
1449 | 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
|
1450 | g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button); |
| 8317 | 1451 | |
| 1452 | /* Sep */ | |
| 1453 | 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
|
1454 | 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
|
1455 | gtk_widget_show_all(sep); |
| 8317 | 1456 | |
|
17594
837c8e6dbef7
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17523
diff
changeset
|
1457 | /* 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
|
1458 | 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
|
1459 | 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
|
1460 | 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
|
1461 | 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
|
1462 | 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
|
1463 | 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
|
1464 | 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
|
1465 | 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
|
1466 | 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
|
1467 | gtk_widget_show_all(insert_button); |
| 8317 | 1468 | |
|
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
|
1469 | 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
|
1470 | g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu); |
| 8317 | 1471 | |
|
18240
0a7d2fde749b
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18238
diff
changeset
|
1472 | 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
|
1473 | 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
|
1474 | 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
|
1475 | 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
|
1476 | G_CALLBACK(button_sensitiveness_changed), menuitem); |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1477 | g_signal_connect(G_OBJECT(toolbar->image), "notify::visible", |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1478 | G_CALLBACK(button_visibility_changed), menuitem); |
| 8317 | 1479 | |
|
18240
0a7d2fde749b
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18238
diff
changeset
|
1480 | 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
|
1481 | 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
|
1482 | 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
|
1483 | 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
|
1484 | G_CALLBACK(button_sensitiveness_changed), menuitem); |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1485 | g_signal_connect(G_OBJECT(toolbar->link), "notify::visible", |
|
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1486 | G_CALLBACK(button_visibility_changed), menuitem); |
|
17499
246d166626f3
disapproval of revision '9e21b4e8a98d7acd373a16a8b5d9c42ccc0f4a3d'
Sean Egan <seanegan@pidgin.im>
parents:
17498
diff
changeset
|
1487 | |
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
1488 | 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
|
1489 | 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
|
1490 | gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24275
diff
changeset
|
1491 | toolbar->insert_hr = menuitem; |
|
19647
5d8cf24e5ce9
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@pidgin.im>
parents:
19213
diff
changeset
|
1492 | |
|
30408
df51a0281cde
Do not trigger the formatting toolbar buttons on right-click.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29662
diff
changeset
|
1493 | g_signal_connect(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); |
|
19213
e273393f4b75
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19199
diff
changeset
|
1494 | 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
|
1495 | g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); |
| 8427 | 1496 | toolbar->sml = NULL; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24275
diff
changeset
|
1497 | |
|
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
|
1498 | /* 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
|
1499 | 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
|
1500 | 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
|
1501 | 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
|
1502 | |
|
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
|
1503 | /* 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
|
1504 | 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
|
1505 | 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
|
1506 | 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
|
1507 | 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
|
1508 | 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
|
1509 | gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
| 20387 | 1510 | 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
|
1511 | 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
|
1512 | gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); |
|
31309
eea56be9e0eb
Fix clicking on buttons in formatting toolbar so they don't try (and
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
31294
diff
changeset
|
1513 | g_signal_connect(G_OBJECT(smiley_button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); |
|
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
|
1514 | 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
|
1515 | 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
|
1516 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1517 | /* Sep */ |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1518 | sep = gtk_vseparator_new(); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1519 | gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1520 | gtk_widget_show_all(sep); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1521 | |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1522 | /* Attention */ |
|
30485
32ab27272f37
Use a helper variable to (vastly, to me) improve readability.
Paul Aurich <darkrain42@pidgin.im>
parents:
30423
diff
changeset
|
1523 | wide_attention_button = g_object_get_data(G_OBJECT(toolbar), "attention"); |
|
32ab27272f37
Use a helper variable to (vastly, to me) improve readability.
Paul Aurich <darkrain42@pidgin.im>
parents:
30423
diff
changeset
|
1524 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1525 | attention_button = gtk_button_new(); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1526 | gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1527 | bbox = gtk_hbox_new(FALSE, 3); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1528 | gtk_container_add(GTK_CONTAINER(attention_button), bbox); |
| 30490 | 1529 | image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1530 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1531 | gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1532 | label = gtk_label_new_with_mnemonic(_("_Attention!")); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1533 | gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1534 | gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); |
| 30490 | 1535 | g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", |
|
30485
32ab27272f37
Use a helper variable to (vastly, to me) improve readability.
Paul Aurich <darkrain42@pidgin.im>
parents:
30423
diff
changeset
|
1536 | G_CALLBACK(gtk_button_clicked), wide_attention_button); |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24275
diff
changeset
|
1537 | gtk_widget_show_all(attention_button); |
| 30490 | 1538 | |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1539 | g_signal_connect(wide_attention_button, "notify::sensitive", |
|
25923
dc9e920cef05
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <malu@pidgin.im>
parents:
25922
diff
changeset
|
1540 | G_CALLBACK(button_sensitiveness_changed), attention_button); |
| 30490 | 1541 | g_signal_connect(wide_attention_button, "notify::visible", |
|
30488
48928cd5e79e
Add notify::visibilty handlers for the 'lean' GtkIMHtmlToolbar,
Paul Aurich <darkrain42@pidgin.im>
parents:
30485
diff
changeset
|
1542 | G_CALLBACK(button_visibility_changed), attention_button); |
|
25923
dc9e920cef05
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <malu@pidgin.im>
parents:
25922
diff
changeset
|
1543 | |
|
25936
e7c4d9db2ce6
Gray out attention toolbar button when creating the toolbar.
Marcus Lundblad <malu@pidgin.im>
parents:
25927
diff
changeset
|
1544 | /* set attention button to be greyed out until we get a conversation */ |
| 30490 | 1545 | gtk_widget_set_sensitive(GTK_WIDGET(wide_attention_button), FALSE); |
| 1546 | ||
|
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
|
1547 | 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
|
1548 | 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
|
1549 | 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
|
1550 | |
|
a9f07315cf37
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19719
diff
changeset
|
1551 | 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
|
1552 | 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
|
1553 | 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
|
1554 | 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
|
1555 | 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
|
1556 | |
|
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
|
1557 | 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
|
1558 | |
|
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
|
1559 | 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
|
1560 | 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
|
1561 | 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
|
1562 | gtk_widget_show(event); |
| 8317 | 1563 | } |
| 1564 | ||
| 1565 | GtkWidget *gtk_imhtmltoolbar_new() | |
| 1566 | { | |
| 1567 | return GTK_WIDGET(g_object_new(gtk_imhtmltoolbar_get_type(), NULL)); | |
| 1568 | } | |
| 1569 | ||
| 1570 | GType gtk_imhtmltoolbar_get_type() | |
| 1571 | { | |
| 1572 | static GType imhtmltoolbar_type = 0; | |
| 1573 | ||
| 1574 | if (!imhtmltoolbar_type) { | |
| 1575 | static const GTypeInfo imhtmltoolbar_info = { | |
| 1576 | sizeof(GtkIMHtmlToolbarClass), | |
| 1577 | NULL, | |
| 1578 | NULL, | |
| 1579 | (GClassInitFunc) gtk_imhtmltoolbar_class_init, | |
| 1580 | NULL, | |
| 1581 | NULL, | |
| 1582 | sizeof (GtkIMHtmlToolbar), | |
| 1583 | 0, | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
11862
diff
changeset
|
1584 | (GInstanceInitFunc) gtk_imhtmltoolbar_init, |
|
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
11862
diff
changeset
|
1585 | NULL |
| 8317 | 1586 | }; |
| 1587 | ||
| 10080 | 1588 | imhtmltoolbar_type = g_type_register_static(GTK_TYPE_HBOX, |
| 8317 | 1589 | "GtkIMHtmlToolbar", &imhtmltoolbar_info, 0); |
| 1590 | } | |
| 1591 | ||
| 1592 | return imhtmltoolbar_type; | |
| 1593 | } | |
| 1594 | ||
| 1595 | ||
|
8324
3bb4ba19837d
[gaim-migrate @ 9048]
Christian Hammond <chipx86@chipx86.com>
parents:
8322
diff
changeset
|
1596 | void gtk_imhtmltoolbar_attach(GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml) |
| 8317 | 1597 | { |
|
8788
a13634443a38
[gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents:
8785
diff
changeset
|
1598 | GtkIMHtmlButtons buttons; |
| 8481 | 1599 | |
|
8325
bb6ed75fcec2
[gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents:
8324
diff
changeset
|
1600 | g_return_if_fail(toolbar != NULL); |
|
bb6ed75fcec2
[gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents:
8324
diff
changeset
|
1601 | g_return_if_fail(GTK_IS_IMHTMLTOOLBAR(toolbar)); |
|
bb6ed75fcec2
[gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents:
8324
diff
changeset
|
1602 | g_return_if_fail(imhtml != NULL); |
|
bb6ed75fcec2
[gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents:
8324
diff
changeset
|
1603 | g_return_if_fail(GTK_IS_IMHTML(imhtml)); |
|
bb6ed75fcec2
[gaim-migrate @ 9049]
Christian Hammond <chipx86@chipx86.com>
parents:
8324
diff
changeset
|
1604 | |
| 8317 | 1605 | toolbar->imhtml = imhtml; |
| 8506 | 1606 | 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
|
1607 | 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
|
1608 | g_signal_connect_after(G_OBJECT(imhtml), "format_function_clear", G_CALLBACK(update_format_cb), toolbar); |
| 8506 | 1609 | g_signal_connect(G_OBJECT(imhtml), "format_function_update", G_CALLBACK(update_format_cb), toolbar); |
| 8516 | 1610 | g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar); |
| 8481 | 1611 | |
|
8788
a13634443a38
[gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents:
8785
diff
changeset
|
1612 | buttons = gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)); |
| 8807 | 1613 | update_buttons_cb(GTK_IMHTML(imhtml), buttons, toolbar); |
|
11267
78f1eb5b3d6e
[gaim-migrate @ 13449]
Richard Laager <rlaager@pidgin.im>
parents:
11243
diff
changeset
|
1614 | update_buttons(toolbar); |
| 8317 | 1615 | } |
| 8427 | 1616 | |
| 1617 | void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) | |
| 1618 | { | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13539
diff
changeset
|
1619 | g_free(toolbar->sml); |
| 8427 | 1620 | toolbar->sml = g_strdup(proto_id); |
| 1621 | } | |
|
25922
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1622 | |
|
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1623 | void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, |
|
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1624 | PurpleConversation *conv) |
|
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1625 | { |
|
25923
dc9e920cef05
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <malu@pidgin.im>
parents:
25922
diff
changeset
|
1626 | PurpleConnection *gc = purple_conversation_get_gc(conv); |
|
25924
0bbcae5e02d3
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <malu@pidgin.im>
parents:
25923
diff
changeset
|
1627 | PurplePlugin *prpl = purple_connection_get_prpl(gc); |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1628 | GtkWidget *attention = |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1629 | g_object_get_data(G_OBJECT(toolbar), "attention"); |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1630 | |
|
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1631 | g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30706
diff
changeset
|
1632 | |
|
25924
0bbcae5e02d3
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <malu@pidgin.im>
parents:
25923
diff
changeset
|
1633 | /* gray out attention button on protocols that don't support it |
|
0bbcae5e02d3
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <malu@pidgin.im>
parents:
25923
diff
changeset
|
1634 | for the time being it is always disabled for chats */ |
|
29482
eef3bb59b723
Temporary workaround to not break ABI, to allow this in for 2.7.0
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
1635 | gtk_widget_set_sensitive(attention, |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30706
diff
changeset
|
1636 | conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
|
25926
b42c35950df5
NULL-check for conversation when updating attention button
Marcus Lundblad <malu@pidgin.im>
parents:
25925
diff
changeset
|
1637 | PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); |
|
25922
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1638 | } |
|
0b83a033abd6
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <malu@pidgin.im>
parents:
25920
diff
changeset
|
1639 |