Mercurial > pidgin.yaz
annotate pidgin/gtkimhtmltoolbar.c @ 29695:b1284d63b969
propagate from branch 'im.pidgin.pidgin' (head 29f6b9d81574bfa9235dbd438a8934f06552e368)
to branch 'im.pidgin.cpw.attention_ui' (head 382194d06f05cbf5030ec6471a719e32bf6ef9d7)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sun, 20 Sep 2009 19:57:21 +0000 |
parents | 618c41ef0ab8 ce876e58cf6a |
children | 28880022598c |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file gtkimhtmltoolbar.c GTK+ IMHtml Toolbar |
16193
247e421c4fa6
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents:
15871
diff
changeset
|
3 * @ingroup pidgin |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
20072
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
20072
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
20072
diff
changeset
|
6 /* pidgin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
8 * Pidgin is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19586
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "internal.h" |
15514 | 28 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "imgstore.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "notify.h" |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
32 #include "prefs.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "request.h" |
15822
84b0f9b23ede
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents:
15786
diff
changeset
|
34 #include "pidginstock.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "util.h" |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
36 #include "debug.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "gtkdialogs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "gtkimhtmltoolbar.h" |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
40 #include "gtksmiley.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "gtkthemes.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "gtkutils.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
17510
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
44 #include <gdk/gdkkeysyms.h> |
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
45 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 static GtkHBoxClass *parent_class = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 static void toggle_button_set_active_block(GtkToggleButton *button, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 gboolean is_active, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 GtkIMHtmlToolbar *toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 static void do_bold(GtkWidget *bold, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 g_return_if_fail(toolbar != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 gtk_imhtml_toggle_bold(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 g_return_if_fail(toolbar != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 gtk_imhtml_toggle_italic(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 g_return_if_fail(toolbar != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 gtk_imhtml_toggle_underline(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 static void |
19469
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
77 do_strikethrough(GtkWidget *strikethrough, GtkIMHtmlToolbar *toolbar) |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
78 { |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
79 g_return_if_fail(toolbar != NULL); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
80 gtk_imhtml_toggle_strike(GTK_IMHTML(toolbar->imhtml)); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
81 gtk_widget_grab_focus(toolbar->imhtml); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
82 } |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
83 |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
84 static void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 g_return_if_fail(toolbar != NULL); |
17421
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
88 /* Only shrink the font on activation, not deactivation as well */ |
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
89 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb))) |
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
90 gtk_imhtml_font_shrink(GTK_IMHTML(toolbar->imhtml)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 g_return_if_fail(toolbar); |
17421
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
98 /* Only grow the font on activation, not deactivation as well */ |
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
99 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) |
c8891ebd48db
Only change the size when the imhtmltoolbar button has been activated,
Kevin Stange <kevin@simguy.net>
parents:
17260
diff
changeset
|
100 gtk_imhtml_font_grow(GTK_IMHTML(toolbar->imhtml)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
104 static gboolean |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 destroy_toolbar_font(GtkWidget *widget, GdkEvent *event, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 if (widget != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 if (toolbar->font_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 gtk_widget_destroy(toolbar->font_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 toolbar->font_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
116 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 GtkFontSelection *sel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 gtk_widget_show_all(sel->family_list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 gtk_widget_show(gtk_widget_get_parent(sel->family_list)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 cancel_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 destroy_toolbar_font(widget, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 |
28598
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
137 static void |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
138 apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 /* this could be expanded to include font size, weight, etc. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 but for now only works with font face */ |
28598
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
142 gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel); |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
143 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
144 "purple_toolbar"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
28598
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
146 if (fontname) { |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
147 const gchar *family_name = NULL; |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
148 PangoFontDescription *desc = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
28598
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
150 desc = pango_font_description_from_string(fontname); |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
151 family_name = pango_font_description_get_family(desc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 |
28598
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
153 if (family_name) { |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
154 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
155 family_name); |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
156 } |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
157 |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
158 pango_font_description_free(desc); |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
159 g_free(fontname); |
401012968fea
Fix apply_font to use a PangoFontDescription to get the requested font family
Etan Reisner <pidgin@unreliablesource.net>
parents:
26712
diff
changeset
|
160 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 cancel_toolbar_font(NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 g_return_if_fail(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 char *fontname = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 if (!toolbar->font_dialog) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
15823 | 176 g_object_set_data(G_OBJECT(toolbar->font_dialog), "purple_toolbar", toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 if(fontname) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 char *fonttif = g_strdup_printf("%s 12", fontname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 g_free(fontname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 fonttif); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 g_free(fonttif); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 DEFAULT_FONT_FACE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 G_CALLBACK(destroy_toolbar_font), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 G_CALLBACK(apply_font), toolbar->font_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 G_CALLBACK(cancel_toolbar_font), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 G_CALLBACK(realize_toolbar_font), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 gtk_window_present(GTK_WINDOW(toolbar->font_dialog)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 cancel_toolbar_font(font, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
205 static gboolean |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 if (widget != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 if (toolbar->fgcolor_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 gtk_widget_destroy(toolbar->fgcolor_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 toolbar->fgcolor_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 } |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
217 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 static void cancel_toolbar_fgcolor(GtkWidget *widget, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 destroy_toolbar_fgcolor(widget, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 static void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 GdkColor text_color; |
15823 | 229 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 char *open_tag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 open_tag = g_malloc(30); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 gtk_color_selection_get_current_color(colorsel, &text_color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 g_snprintf(open_tag, 23, "#%02X%02X%02X", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 text_color.red / 256, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 text_color.green / 256, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 text_color.blue / 256); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 gtk_imhtml_toggle_forecolor(GTK_IMHTML(toolbar->imhtml), open_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 g_free(open_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 cancel_toolbar_fgcolor(NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 GtkWidget *colorsel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 GdkColor fgcolor; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 if (!toolbar->fgcolor_dialog) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 if (color) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 gdk_color_parse(color, &fgcolor); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 g_free(color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
15823 | 262 g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 G_CALLBACK(destroy_toolbar_fgcolor), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 G_CALLBACK(do_fgcolor), colorsel); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 G_CALLBACK(cancel_toolbar_fgcolor), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 cancel_toolbar_fgcolor(color, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
278 static gboolean |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 if (widget != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, NULL, NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 if (toolbar->bgcolor_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 gtk_widget_destroy(toolbar->bgcolor_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 toolbar->bgcolor_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 } |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
294 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 cancel_toolbar_bgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 destroy_toolbar_bgcolor(widget, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 static void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 GdkColor text_color; |
15823 | 306 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 char *open_tag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 open_tag = g_malloc(30); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 gtk_color_selection_get_current_color(colorsel, &text_color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 g_snprintf(open_tag, 23, "#%02X%02X%02X", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 text_color.red / 256, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 text_color.green / 256, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 text_color.blue / 256); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, NULL, NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 gtk_imhtml_toggle_backcolor(GTK_IMHTML(toolbar->imhtml), open_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 gtk_imhtml_toggle_background(GTK_IMHTML(toolbar->imhtml), open_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 g_free(open_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 cancel_toolbar_bgcolor(NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 GtkWidget *colorsel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 GdkColor bgcolor; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 if (!toolbar->bgcolor_dialog) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 if (color) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 gdk_color_parse(color, &bgcolor); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 g_free(color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 |
15823 | 342 g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 G_CALLBACK(destroy_toolbar_bgcolor), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 G_CALLBACK(do_bgcolor), colorsel); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 G_CALLBACK(cancel_toolbar_bgcolor), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 cancel_toolbar_bgcolor(color, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 clear_formatting_cb(GtkWidget *clear, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->clear), FALSE, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 gtk_imhtml_clear_formatting(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 static void |
15823 | 367 cancel_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 toolbar->link_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 close_link_dialog(GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 if (toolbar->link_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 { |
15823 | 379 purple_request_close(PURPLE_REQUEST_FIELDS, toolbar->link_dialog); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 toolbar->link_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 static void |
15823 | 385 do_insert_link_cb(GtkIMHtmlToolbar *toolbar, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 const char *url, *description; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
15823 | 389 url = purple_request_fields_get_string(fields, "url"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 if (GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) |
15823 | 391 description = purple_request_fields_get_string(fields, "description"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 description = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 if (description == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 description = url; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 gtk_text_buffer_get_insert(GTK_IMHTML(toolbar->imhtml)->text_buffer), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 url, description); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 toolbar->link_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { |
15823 | 411 PurpleRequestFields *fields; |
412 PurpleRequestFieldGroup *group; | |
413 PurpleRequestField *field; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 GtkTextIter start, end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 char *desc = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 |
15823 | 418 fields = purple_request_fields_new(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 |
15823 | 420 group = purple_request_field_group_new(NULL); |
421 purple_request_fields_add_group(fields, group); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 |
15823 | 423 field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE); |
424 purple_request_field_set_required(field, TRUE); | |
425 purple_request_field_group_add_field(group, field); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 if(GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 if (gtk_text_buffer_get_selection_bounds(GTK_IMHTML(toolbar->imhtml)->text_buffer, &start, &end)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 desc = gtk_imhtml_get_text(GTK_IMHTML(toolbar->imhtml), &start, &end); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 } |
15823 | 431 field = purple_request_field_string_new("description", _("_Description"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 desc, FALSE); |
15823 | 433 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 msg = g_strdup(_("Please enter the URL and description of the " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 "link that you want to insert. The description " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 "is optional.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 msg = g_strdup(_("Please enter the URL of the " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 "link that you want to insert.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 toolbar->link_dialog = |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
443 purple_request_fields(toolbar, _("Insert Link"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 NULL, |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
445 msg, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 _("_Insert"), G_CALLBACK(do_insert_link_cb), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 _("Cancel"), G_CALLBACK(cancel_link_cb), |
21570
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
449 NULL, NULL, NULL, |
dccfd999ffe7
merge of '76c07fcb434a2a7aa289734bb221c171a376d73b'
Evan Schoenberg <evan.s@dreskin.net>
parents:
21244
diff
changeset
|
450 toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 g_free(desc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 close_link_dialog(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 |
19469
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
459 static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
460 { |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
461 GtkTextIter iter; |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
462 GtkTextMark *ins; |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
463 GtkIMHtmlScalable *hr; |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
464 |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
465 ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
466 gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
467 hr = gtk_imhtml_hr_new(); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
468 gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
469 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 do_insert_image_cb(GtkWidget *widget, int response, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 gchar *filename, *name, *buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 char *filedata; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 size_t size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 GError *error = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 int id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 GtkTextIter iter; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 GtkTextMark *ins; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
21866
03c950701fac
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents:
21839
diff
changeset
|
483 if (response != GTK_RESPONSE_ACCEPT) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 #else /* FILECHOOSER */ |
21866
03c950701fac
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents:
21839
diff
changeset
|
485 if (response != GTK_RESPONSE_OK) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 #endif /* FILECHOOSER */ |
21866
03c950701fac
Move some curly braces around so static analysis tools can properly detect
Stu Tomlinson <stu@nosnilmot.com>
parents:
21839
diff
changeset
|
487 { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 #else /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(widget))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 #endif /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 if (filename == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
504 if (pidgin_check_if_dir(filename, GTK_FILE_SELECTION(widget))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 #endif /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 /* The following triggers a callback that closes the widget */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 if (!g_file_get_contents(filename, &filedata, &size, &error)) { |
15823 | 515 purple_notify_error(NULL, NULL, error->message, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 g_error_free(error); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 name = strrchr(filename, G_DIR_SEPARATOR) + 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 |
16375
391a79778f89
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
525 id = purple_imgstore_add_with_id(filedata, size, name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 if (id == 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 buf = g_strdup_printf(_("Failed to store image: %s\n"), filename); |
15823 | 529 purple_notify_error(NULL, NULL, buf, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 g_free(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 &iter, ins); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 gtk_imhtml_insert_image_at_iter(GTK_IMHTML(toolbar->imhtml), id, &iter); |
16375
391a79778f89
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
543 purple_imgstore_unref_by_id(id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 GtkWidget *window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 window = gtk_file_chooser_dialog_new(_("Insert Image"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 GTK_FILE_CHOOSER_ACTION_OPEN, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 "response", G_CALLBACK(do_insert_image_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 #else /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 window = gtk_file_selection_new(_("Insert Image")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_OK); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 "response", G_CALLBACK(do_insert_image_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 #endif /* FILECHOOSER */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 gtk_widget_show(window); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 toolbar->image_dialog = window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 gtk_widget_destroy(toolbar->image_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 toolbar->image_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 destroy_smiley_dialog(GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 if (toolbar->smiley_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 gtk_widget_destroy(toolbar->smiley_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 toolbar->smiley_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
591 static gboolean |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
592 close_smiley_dialog(GtkIMHtmlToolbar *toolbar) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE); |
21913
2a591a5b3322
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21866
diff
changeset
|
595 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 char *smiley_text, *escaped_smiley; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 escaped_smiley = g_markup_escape_text(smiley_text, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 gtk_imhtml_insert_smiley(GTK_IMHTML(toolbar->imhtml), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 GTK_IMHTML(toolbar->imhtml)->protocol_name, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 escaped_smiley); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 g_free(escaped_smiley); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
613 close_smiley_dialog(toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 /* smiley buttons list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 struct smiley_button_list { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 int width, height; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 GtkWidget *button; |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
620 const GtkIMHtmlSmiley *smiley; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 struct smiley_button_list *next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 static struct smiley_button_list * |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
625 sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
626 int *width, const GtkIMHtmlSmiley *smiley) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 GtkWidget *image; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 GtkWidget *button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 GtkRequisition size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 struct smiley_button_list *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 struct smiley_button_list *it, *it_last; |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
633 const gchar *filename = smiley->file; |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
634 gchar *face = smiley->smile; |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
635 PurpleSmiley *psmiley = NULL; |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
636 gboolean supports_custom = (gtk_imhtml_get_format_functions(GTK_IMHTML(toolbar->imhtml)) & GTK_IMHTML_CUSTOM_SMILEY); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
22825
28005860d2c9
Plug a small memory leak in the smiley dialog, and use g_new0/g_free
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
638 cur = g_new0(struct smiley_button_list, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 it = ls; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 it_last = ls; /* list iterators*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 image = gtk_image_new_from_file(filename); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 gtk_widget_size_request(image, &size); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
644 |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
645 if (size.width > 24 && |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
646 smiley->flags & GTK_IMHTML_SMILEY_CUSTOM) { /* This is a custom smiley, let's scale it */ |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
647 GdkPixbuf *pixbuf = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
648 GtkImageType type; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
649 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
650 type = gtk_image_get_storage_type(GTK_IMAGE(image)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
651 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
652 if (type == GTK_IMAGE_PIXBUF) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
653 pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); |
23132
9c0a47402f7a
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23131
diff
changeset
|
654 } else if (type == GTK_IMAGE_ANIMATION) { |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
655 GdkPixbufAnimation *animation; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
656 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
657 animation = gtk_image_get_animation(GTK_IMAGE(image)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
658 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
659 pixbuf = gdk_pixbuf_animation_get_static_image(animation); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
660 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
661 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
662 if (pixbuf != NULL) { |
23132
9c0a47402f7a
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23131
diff
changeset
|
663 GdkPixbuf *resized; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
664 resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
665 GDK_INTERP_HYPER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
666 |
23134
85c595142be6
A leak fix from malu. Thanks!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23133
diff
changeset
|
667 gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */ |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
668 gtk_widget_size_request(image, &size); |
23132
9c0a47402f7a
Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23131
diff
changeset
|
669 g_object_unref(G_OBJECT(resized)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
670 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
671 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
672 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 (*width) += size.width; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 button = gtk_button_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 gtk_container_add(GTK_CONTAINER(button), image); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 g_object_set_data(G_OBJECT(button), "smiley_text", face); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 /* these look really weird with borders */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
686 psmiley = purple_smileys_find_by_shortcut(smiley->smile); |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
687 /* If this is a "non-custom" smiley, check to see if its shortcut is |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
688 "shadowed" by any custom smiley. This can only happen if the connection |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
689 is custom smiley-enabled */ |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
690 if (supports_custom && psmiley && !(smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) { |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
691 gchar tip[128]; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24007
diff
changeset
|
692 g_snprintf(tip, sizeof(tip), |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
693 _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
694 face); |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
695 gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
696 gtk_widget_set_sensitive(button, FALSE); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
697 } else if (psmiley) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
698 /* Remove the button if the smiley is destroyed */ |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
699 g_signal_connect_object(G_OBJECT(psmiley), "destroy", G_CALLBACK(gtk_widget_destroy), |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
700 button, G_CONNECT_SWAPPED); |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
701 } |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
702 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 /* set current element to add */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 cur->height = size.height; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 cur->width = size.width; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 cur->button = button; |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
707 cur->smiley = smiley; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 cur->next = ls; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 /* check where to insert by height */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 if (ls == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 return cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 while (it != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 it_last = it; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 it = it->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 cur->next = it; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 it_last->next = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 return ls; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 while (list) { |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
726 GtkIMHtmlSmiley *cur = (GtkIMHtmlSmiley *) list->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 if (!strcmp(cur->file, smiley->file)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 list = list->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
17510
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
734 static gboolean |
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
735 smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar) |
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
736 { |
18388
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
737 if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) || |
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
738 (event->type == GDK_BUTTON_PRESS && event->button.button == 1)) |
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
739 { |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
740 close_smiley_dialog(toolbar); |
18388
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
741 return TRUE; |
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
742 } |
17510
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
743 |
18388
ec29522b76d0
Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents:
18387
diff
changeset
|
744 return FALSE; |
17510
8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17260
diff
changeset
|
745 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 static void |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
748 add_smiley_list(GtkWidget *container, struct smiley_button_list *list, |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
749 int max_width, gboolean custom) |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
750 { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
751 GtkWidget *line; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
752 int line_width = 0; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
753 |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
754 if (!list) |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
755 return; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
756 |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
757 line = gtk_hbox_new(FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
758 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
759 for (; list; list = list->next) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
760 if (custom != !!(list->smiley->flags & GTK_IMHTML_SMILEY_CUSTOM)) |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
761 continue; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
762 gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
763 gtk_widget_show(list->button); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
764 line_width += list->width; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
765 if (line_width >= max_width) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
766 if (list->next) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
767 line = gtk_hbox_new(FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
768 gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
769 } |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
770 line_width = 0; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
771 } |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
772 } |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
773 } |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
774 |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
775 static void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 { |
23155
7dccb11c5f1d
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23144
diff
changeset
|
778 GtkWidget *dialog, *vbox; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 GtkWidget *smiley_table = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 GSList *smileys, *unique_smileys = NULL; |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
781 const GSList *custom_smileys = NULL; |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
782 gboolean supports_custom = FALSE; |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
783 GtkRequisition req; |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
784 GtkWidget *scrolled, *viewport; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 destroy_smiley_dialog(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 if (toolbar->sml) |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16193
diff
changeset
|
793 smileys = pidgin_themes_get_proto_smileys(toolbar->sml); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 else |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16193
diff
changeset
|
795 smileys = pidgin_themes_get_proto_smileys(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
797 /* Note: prepend smileys to list to avoid O(n^2) overhead when there is |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
798 a large number of smileys... need to revers the list after for the dialog |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
799 work... */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 while(smileys) { |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
801 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) smileys->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 if(!smiley->hidden) { |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
803 if(smiley_is_unique(unique_smileys, smiley)) { |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
804 unique_smileys = g_slist_prepend(unique_smileys, smiley); |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
805 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 smileys = smileys->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 } |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
809 supports_custom = (gtk_imhtml_get_format_functions(GTK_IMHTML(toolbar->imhtml)) & GTK_IMHTML_CUSTOM_SMILEY); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
810 if (toolbar->imhtml && supports_custom) { |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
811 const GSList *iterator = NULL; |
23133
9aa105267f46
Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
812 custom_smileys = pidgin_smileys_get_all(); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
813 |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
814 for (iterator = custom_smileys ; iterator ; |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
815 iterator = g_slist_next(iterator)) { |
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
816 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) iterator->data; |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
817 unique_smileys = g_slist_prepend(unique_smileys, smiley); |
23133
9aa105267f46
Show the custom smileys only on accounts that support it. References
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
818 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
819 } |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24007
diff
changeset
|
820 |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
821 /* we need to reverse the list to get the smileys in the correct order */ |
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
822 unique_smileys = g_slist_reverse(unique_smileys); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
823 |
21971
07eb63fa0bdb
Modified patch from Gabriel (Sylar?) Schulof to deprecate PIDGIN_DIALOG. Closes #4535. (PS: I am aware of --author).
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21913
diff
changeset
|
824 dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); |
23155
7dccb11c5f1d
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23144
diff
changeset
|
826 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, 0); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 |
15786
e926951e61fe
Don't use g_list_length() and g_slist_length() when all you want to
Mark Doliner <mark@kingant.net>
parents:
15560
diff
changeset
|
828 if (unique_smileys != NULL) { |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
829 struct smiley_button_list *ls; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
830 int max_line_width, num_lines, button_width = 0; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 /* We use hboxes packed in a vbox */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 ls = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 max_line_width = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 num_lines = floor(sqrt(g_slist_length(unique_smileys))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 smiley_table = gtk_vbox_new(FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
838 if (supports_custom) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
839 GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys")); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
840 GtkRequisition req; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
841 g_signal_connect(G_OBJECT(manage), "clicked", |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
842 G_CALLBACK(pidgin_smiley_manager_show), NULL); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
843 g_signal_connect_swapped(G_OBJECT(manage), "clicked", |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
844 G_CALLBACK(gtk_widget_destroy), dialog); |
23155
7dccb11c5f1d
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23144
diff
changeset
|
845 gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0); |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
846 gtk_widget_size_request(manage, &req); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
847 button_width = req.width; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
848 } |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
849 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 /* create list of smileys sorted by height */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 while (unique_smileys) { |
23137
dfc99f5dec43
Patch from malu (mlundblad) to disable a regular smiley in the smiley
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23134
diff
changeset
|
852 GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) unique_smileys->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 if (!smiley->hidden) { |
23343
3cc64898bdbd
Do not disable default smileys with dupliate shortcuts if custom smileys
Marcus Lundblad <ml@update.uu.se>
parents:
23227
diff
changeset
|
854 ls = sort_smileys(ls, toolbar, &max_line_width, smiley); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 } |
22825
28005860d2c9
Plug a small memory leak in the smiley dialog, and use g_new0/g_free
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22093
diff
changeset
|
856 unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 } |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
858 /* The window will be at least as wide as the 'Manage ..' button */ |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
859 max_line_width = MAX(button_width, max_line_width / num_lines); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
860 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 /* pack buttons of the list */ |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
862 add_smiley_list(smiley_table, ls, max_line_width, FALSE); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
863 if (supports_custom) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
864 gtk_box_pack_start(GTK_BOX(smiley_table), gtk_hseparator_new(), TRUE, FALSE, 0); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
865 add_smiley_list(smiley_table, ls, max_line_width, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 } |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
867 while (ls) { |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
868 struct smiley_button_list *tmp = ls->next; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
869 g_free(ls); |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
870 ls = tmp; |
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
871 } |
18389
0ef0b2ead713
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents:
18388
diff
changeset
|
872 |
0ef0b2ead713
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents:
18388
diff
changeset
|
873 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 smiley_table = gtk_label_new(_("This theme has no available smileys.")); |
18389
0ef0b2ead713
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents:
18388
diff
changeset
|
877 gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK); |
0ef0b2ead713
Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents:
18388
diff
changeset
|
878 g_signal_connect(G_OBJECT(dialog), "button-press-event", (GCallback)smiley_dialog_input_cb, toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
881 scrolled = gtk_scrolled_window_new (NULL, NULL); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
882 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_NONE); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
883 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
884 GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
23155
7dccb11c5f1d
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23144
diff
changeset
|
885 gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
886 gtk_widget_show(scrolled); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
888 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), smiley_table); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 gtk_widget_show(smiley_table); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
891 viewport = gtk_widget_get_parent(smiley_table); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
892 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
893 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 /* connect signals */ |
23139
53b3c75c9e26
Separate the custom smileys from the regular smileys, and add a 'Manage'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23138
diff
changeset
|
895 g_signal_connect_swapped(G_OBJECT(dialog), "destroy", G_CALLBACK(close_smiley_dialog), toolbar); |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
896 g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(smiley_dialog_input_cb), toolbar); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
897 |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
898 gtk_window_set_transient_for(GTK_WINDOW(dialog), |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
899 GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar)))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 /* show everything */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 gtk_widget_show_all(dialog); |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
903 |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
904 gtk_widget_size_request(viewport, &req); |
23155
7dccb11c5f1d
Put the 'manage' button outside the scrolling area.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23144
diff
changeset
|
905 gtk_widget_set_size_request(scrolled, MIN(300, req.width), MIN(290, req.height)); |
23142
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
906 |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
907 /* The window has to be made resizable, and the scrollbars in the scrolled window |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
908 * enabled only after setting the desired size of the window. If we do either of |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
909 * these tasks before now, GTK+ miscalculates the required size, and erronously |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
910 * makes one or both scrollbars visible (sometimes). |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
911 * I too think this hack is gross. But I couldn't find a better way -- sadrul */ |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
912 gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
913 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
914 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
a372713e405c
Patch from Giulio 'Twain28' Pascali to make the smiley window scrollable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23139
diff
changeset
|
915 |
20657
c2c263d47534
Prevent the smiley window appearing outside of the working area on win32. Fixes #3261.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20160
diff
changeset
|
916 #ifdef _WIN32 |
c2c263d47534
Prevent the smiley window appearing outside of the working area on win32. Fixes #3261.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20160
diff
changeset
|
917 winpidgin_ensure_onscreen(dialog); |
c2c263d47534
Prevent the smiley window appearing outside of the working area on win32. Fixes #3261.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20160
diff
changeset
|
918 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 toolbar->smiley_dialog = dialog; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 gtk_widget_grab_focus(toolbar->imhtml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
29638
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
925 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
926 { |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
927 PurpleConversation *conv = toolbar->active_conv; |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
928 const gchar *who = purple_conversation_get_name(conv); |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
929 PurpleConnection *gc = purple_conversation_get_gc(conv); |
29641
a5b5391ab963
Removed unfinished code to send attention from the toolbar, to avoid confusion...
Marcus Lundblad <ml@update.uu.se>
parents:
29638
diff
changeset
|
930 |
29648
9c928fb69ace
Reset attention toolbar button (for "expanded" toolbar view)
Marcus Lundblad <ml@update.uu.se>
parents:
29647
diff
changeset
|
931 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->attention), FALSE, |
9c928fb69ace
Reset attention toolbar button (for "expanded" toolbar view)
Marcus Lundblad <ml@update.uu.se>
parents:
29647
diff
changeset
|
932 toolbar); |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
933 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL)); |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
934 purple_prpl_send_attention(gc, who, 0); |
29638
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
935 } |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
936 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 static void update_buttons_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_IMHTML_BOLD); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->italic), buttons & GTK_IMHTML_ITALIC); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->underline), buttons & GTK_IMHTML_UNDERLINE); |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
942 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->strikethrough), buttons & GTK_IMHTML_STRIKE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->larger_size), buttons & GTK_IMHTML_GROW); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smaller_size), buttons & GTK_IMHTML_SHRINK); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->font), buttons & GTK_IMHTML_FACE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->fgcolor), buttons & GTK_IMHTML_FORECOLOR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bgcolor), buttons & GTK_IMHTML_BACKCOLOR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->clear), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 (buttons & GTK_IMHTML_BOLD || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 buttons & GTK_IMHTML_ITALIC || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 buttons & GTK_IMHTML_UNDERLINE || |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
955 buttons & GTK_IMHTML_STRIKE || |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 buttons & GTK_IMHTML_GROW || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 buttons & GTK_IMHTML_SHRINK || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 buttons & GTK_IMHTML_FACE || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 buttons & GTK_IMHTML_FORECOLOR || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 buttons & GTK_IMHTML_BACKCOLOR)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->image), buttons & GTK_IMHTML_IMAGE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->link), buttons & GTK_IMHTML_LINK); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smiley), buttons & GTK_IMHTML_SMILEY); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 /* we call this when we want to _set_active the toggle button, it'll |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 * block the callback thats connected to the button so we don't have to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 * do the double toggling hack |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 static void toggle_button_set_active_block(GtkToggleButton *button, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 gboolean is_active, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 GObject *object; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 g_return_if_fail(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 object = g_object_ref(button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 0, 0, NULL, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 gtk_toggle_button_set_active(button, is_active); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 0, 0, NULL, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 g_object_unref(object); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
987 static void update_buttons(GtkIMHtmlToolbar *toolbar) |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
988 { |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
989 gboolean bold, italic, underline, strike; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 char *tmp2; |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
992 GtkLabel *label = g_object_get_data(G_OBJECT(toolbar), "font_label"); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
993 |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
994 gtk_label_set_label(label, _("_Font")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 gtk_imhtml_get_current_format(GTK_IMHTML(toolbar->imhtml), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 &bold, &italic, &underline); |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
998 strike = GTK_IMHTML(toolbar->imhtml)->edit.strike; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->underline)) != underline) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->underline), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 underline, toolbar); |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1009 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->strikethrough)) != strike) |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1010 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->strikethrough), |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1011 strike, toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 /* These buttons aren't ever "active". */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1017 if (bold) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1018 gchar *markup = g_strdup_printf("<b>%s</b>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1019 gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1020 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1021 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1022 } |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1023 if (italic) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1024 gchar *markup = g_strdup_printf("<i>%s</i>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1025 gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1026 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1027 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1028 } |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1029 if (underline) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1030 gchar *markup = g_strdup_printf("<u>%s</u>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1031 gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1032 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1033 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1034 } |
19541
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1035 if (strike) { |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1036 gchar *markup = g_strdup_printf("<s>%s</s>", |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1037 gtk_label_get_label(label)); |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1038 gtk_label_set_markup_with_mnemonic(label, markup); |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1039 g_free(markup); |
5d178cf627e9
Update the strikethrough state and the buttons as appropriate. Fixes #2884.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19469
diff
changeset
|
1040 } |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1041 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 tmp = gtk_imhtml_get_current_fontface(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 (tmp != NULL), toolbar); |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1045 if (tmp != NULL) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1046 gchar *markup = g_strdup_printf("<span font_desc=\"%s\">%s</span>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1047 tmp, gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1048 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1049 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1050 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 tmp = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 (tmp != NULL), toolbar); |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1056 if (tmp != NULL) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1057 gchar *markup = g_strdup_printf("<span foreground=\"%s\">%s</span>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1058 tmp, gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1059 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1060 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1061 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 tmp = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 tmp2 = gtk_imhtml_get_current_background(GTK_IMHTML(toolbar->imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 (tmp != NULL || tmp2 != NULL), toolbar); |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1068 if (tmp != NULL) { |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1069 gchar *markup = g_strdup_printf("<span background=\"%s\">%s</span>", |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1070 tmp, gtk_label_get_label(label)); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1071 gtk_label_set_markup_with_mnemonic(label, markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1072 g_free(markup); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1073 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 g_free(tmp2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 static void toggle_button_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 update_buttons(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 static void update_format_cb(GtkIMHtml *imhtml, GtkIMHtmlToolbar *toolbar) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 update_buttons(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 GtkTextMark *mark, GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 if(mark != gtk_text_buffer_get_insert(buffer)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 update_buttons(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1096 |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1097 /* This comes from gtkmenutoolbutton.c from gtk+ |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1098 * Copyright (C) 2003 Ricardo Fernandez Pascual |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1099 * Copyright (C) 2004 Paolo Borelli |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1100 */ |
17655
4d53ccae32b0
Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <stu@nosnilmot.com>
parents:
17549
diff
changeset
|
1101 static void |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1102 menu_position_func (GtkMenu *menu, |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1103 int *x, |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1104 int *y, |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1105 gboolean *push_in, |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1106 gpointer data) |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1107 { |
18166
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1108 GtkWidget *widget = GTK_WIDGET(data); |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1109 GtkRequisition menu_req; |
18166
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1110 gint ythickness = widget->style->ythickness; |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1111 int savy; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1112 |
18166
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1113 gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1114 gdk_window_get_origin(widget->window, x, y); |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1115 *x += widget->allocation.x; |
18166
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1116 *y += widget->allocation.y + widget->allocation.height; |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1117 savy = *y; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1118 |
18166
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1119 pidgin_menu_position_func_helper(menu, x, y, push_in, data); |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1120 |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1121 if (savy > *y + ythickness + 1) |
afeb35205669
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents:
18113
diff
changeset
|
1122 *y -= widget->allocation.height; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1123 } |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1124 |
18851
9998470a01de
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18838
diff
changeset
|
1125 static void pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu) |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1126 { |
18802
5a5ca6438308
show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@gmail.com>
parents:
18794
diff
changeset
|
1127 gtk_widget_show_all(GTK_WIDGET(menu)); |
5a5ca6438308
show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@gmail.com>
parents:
18794
diff
changeset
|
1128 gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time()); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1129 } |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1130 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1131 static void pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button) |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1132 { |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1133 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1134 } |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1135 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 enum { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 LAST_SIGNAL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 /* static guint signals [LAST_SIGNAL] = { 0 }; */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 gtk_imhtmltoolbar_finalize (GObject *object) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 GtkIMHtmlToolbar *toolbar = GTK_IMHTMLTOOLBAR(object); |
18778
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1145 GtkWidget *menu; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 if (toolbar->image_dialog != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 gtk_widget_destroy(toolbar->image_dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 toolbar->image_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 destroy_toolbar_font(NULL, NULL, toolbar); |
23227
1bdf8223ba45
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23155
diff
changeset
|
1154 if (toolbar->smiley_dialog != NULL) { |
1bdf8223ba45
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23155
diff
changeset
|
1155 g_signal_handlers_disconnect_by_func(G_OBJECT(toolbar->smiley_dialog), close_smiley_dialog, toolbar); |
1bdf8223ba45
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23155
diff
changeset
|
1156 destroy_smiley_dialog(toolbar); |
1bdf8223ba45
Prevent a crash when the imhtmltoolbar is disposed and the smiley dialog is open.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23155
diff
changeset
|
1157 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 destroy_toolbar_bgcolor(NULL, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 destroy_toolbar_fgcolor(NULL, NULL, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 close_link_dialog(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 if (toolbar->imhtml) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 g_signal_handlers_disconnect_matched(toolbar->imhtml, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 g_signal_handlers_disconnect_matched(GTK_IMHTML(toolbar->imhtml)->text_buffer, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1166 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 |
24007
8777560c1d9f
Use the correct free() function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23391
diff
changeset
|
1170 g_free(toolbar->sml); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 |
18778
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1173 menu = g_object_get_data(object, "font_menu"); |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1174 if (menu) |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1175 gtk_widget_destroy(menu); |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1176 menu = g_object_get_data(object, "insert_menu"); |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1177 if (menu) |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1178 gtk_widget_destroy(menu); |
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1179 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1180 purple_prefs_disconnect_by_handle(object); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1181 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 G_OBJECT_CLASS(parent_class)->finalize (object); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1185 static void |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1186 switch_toolbar_view(GtkWidget *item, GtkIMHtmlToolbar *toolbar) |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1187 { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1188 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1189 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1190 } |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1191 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1192 static gboolean |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1193 gtk_imhtmltoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, GtkIMHtmlToolbar *toolbar) |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1194 { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1195 GtkWidget *menu; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1196 GtkWidget *item; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1197 gboolean wide; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1198 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1199 if (event->button != 3) |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1200 return FALSE; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1201 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1202 wide = GTK_WIDGET_VISIBLE(toolbar->bold); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1203 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1204 menu = gtk_menu_new(); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1205 item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1206 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1207 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1208 gtk_widget_show(item); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1209 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1210 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1211 widget, event->button, event->time); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1212 return TRUE; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1213 } |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1214 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 /* Boring GTK+ stuff */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 static void gtk_imhtmltoolbar_class_init (GtkIMHtmlToolbarClass *class) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 GtkObjectClass *object_class; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 GObjectClass *gobject_class; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 object_class = (GtkObjectClass*) class; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 gobject_class = (GObjectClass*) class; |
26712
38a5df43d525
Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26434
diff
changeset
|
1222 parent_class = g_type_class_ref(GTK_TYPE_HBOX); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 gobject_class->finalize = gtk_imhtmltoolbar_finalize; |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1224 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1225 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/toolbar"); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1226 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1229 static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1230 { |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1231 GtkWidget *hbox; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1232 GtkWidget *button; |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1233 struct { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1234 char *stock; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1235 gpointer callback; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1236 GtkWidget **button; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1237 const char *tooltip; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1238 } buttons[] = { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1239 {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &toolbar->bold, _("Bold")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1240 {GTK_STOCK_ITALIC, do_italic, &toolbar->italic, _("Italic")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1241 {GTK_STOCK_UNDERLINE, do_underline, &toolbar->underline, _("Underline")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1242 {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &toolbar->strikethrough, _("Strikethrough")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1243 {"", NULL, NULL, NULL}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1244 {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &toolbar->larger_size, _("Increase Font Size")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1245 {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &toolbar->smaller_size, _("Decrease Font Size")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1246 {"", NULL, NULL, NULL}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1247 {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &toolbar->font, _("Font Face")}, |
28599
618c41ef0ab8
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <pidgin@unreliablesource.net>
parents:
28598
diff
changeset
|
1248 {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, |
21839
e7a2dcfc344f
Patch from DHowett to fix the transposition of background and forebround colors
Sean Egan <seanegan@gmail.com>
parents:
21770
diff
changeset
|
1249 {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &toolbar->bgcolor, _("Background Color")}, |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1250 {"", NULL, NULL, NULL}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1251 {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1252 {"", NULL, NULL, NULL}, |
28599
618c41ef0ab8
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <pidgin@unreliablesource.net>
parents:
28598
diff
changeset
|
1253 {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1254 {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, |
28599
618c41ef0ab8
Re-order the ungrouped formatting toolbar buttons to match the order of the
Etan Reisner <pidgin@unreliablesource.net>
parents:
28598
diff
changeset
|
1255 {"", NULL, NULL, NULL}, |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1256 {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, |
29638
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1257 {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1258 _("Send Attention")}, |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1259 {NULL, NULL, NULL, NULL} |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1260 }; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1261 int iter; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1262 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1263 hbox = gtk_hbox_new(FALSE, 0); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1264 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1265 for (iter = 0; buttons[iter].stock; iter++) { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1266 if (buttons[iter].stock[0]) { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1267 button = pidgin_pixbuf_toolbar_button_from_stock(buttons[iter].stock); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1268 g_signal_connect(G_OBJECT(button), "clicked", |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1269 G_CALLBACK(buttons[iter].callback), toolbar); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1270 *(buttons[iter].button) = button; |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1271 gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1272 } else |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1273 button = gtk_vseparator_new(); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1274 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1275 } |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1276 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1277 gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1278 g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1279 } |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1280 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1281 static void |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1282 button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1283 { |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1284 gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1285 } |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1286 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1287 static void |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1288 update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1289 { |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1290 g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1291 gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button)); |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1292 g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1293 } |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1294 |
18838
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1295 static void |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1296 enable_markup(GtkWidget *widget, gpointer null) |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1297 { |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1298 if (GTK_IS_LABEL(widget)) |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1299 g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL); |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1300 } |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1301 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1302 static void |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1303 imhtmltoolbar_view_pref_changed(const char *name, PurplePrefType type, |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1304 gconstpointer value, gpointer toolbar) |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1305 { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1306 if (value) { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1307 gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1308 gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1309 } else { |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1310 gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1311 gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1312 } |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1313 } |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1314 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 { |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1317 GtkWidget *hbox = GTK_WIDGET(toolbar), *event = gtk_event_box_new(); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1318 GtkWidget *bbox, *box = gtk_hbox_new(FALSE, 0); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1319 GtkWidget *image; |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1320 GtkWidget *label; |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1321 GtkWidget *insert_button; |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1322 GtkWidget *font_button; |
20072
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1323 GtkWidget *smiley_button; |
29638
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1324 GtkWidget *attention_button; |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1325 GtkWidget *font_menu; |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1326 GtkWidget *insert_menu; |
18167
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1327 GtkWidget *menuitem; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 GtkWidget *sep; |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1329 int i; |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1330 struct { |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1331 const char *label; |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1332 GtkWidget **button; |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1333 gboolean check; |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1334 } buttons[] = { |
18838
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1335 {_("<b>_Bold</b>"), &toolbar->bold, TRUE}, |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1336 {_("<i>_Italic</i>"), &toolbar->italic, TRUE}, |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1337 {_("<u>_Underline</u>"), &toolbar->underline, TRUE}, |
19469
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
1338 {_("<span strikethrough='true'>Strikethrough</span>"), &toolbar->strikethrough, TRUE}, |
18838
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1339 {_("<span size='larger'>_Larger</span>"), &toolbar->larger_size, TRUE}, |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1340 #if 0 |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1341 {_("_Normal"), &toolbar->normal_size, TRUE}, |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1342 #endif |
18838
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1343 {_("<span size='smaller'>_Smaller</span>"), &toolbar->smaller_size, TRUE}, |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1344 /* If we want to show the formatting for the following items, we would |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1345 * need to update them when formatting changes. The above items don't need |
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1346 * no updating nor nothin' */ |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1347 {_("_Font face"), &toolbar->font, TRUE}, |
18792
b193b5921665
I thought I fixed this already...
Kevin Stange <kevin@simguy.net>
parents:
18780
diff
changeset
|
1348 {_("Foreground _color"), &toolbar->fgcolor, TRUE}, |
18793
4e46e5f6586a
Another mnemonic conflict
Kevin Stange <kevin@simguy.net>
parents:
18792
diff
changeset
|
1349 {_("Bac_kground color"), &toolbar->bgcolor, TRUE}, |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1350 {_("_Reset formatting"), &toolbar->clear, FALSE}, |
18789
09082badaa46
Get rid of two minor compile warnings:
Mark Doliner <mark@kingant.net>
parents:
18780
diff
changeset
|
1351 {NULL, NULL, FALSE} |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1352 }; |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1353 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 toolbar->imhtml = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 toolbar->font_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1356 toolbar->fgcolor_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 toolbar->bgcolor_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 toolbar->link_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 toolbar->smiley_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1360 toolbar->image_dialog = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 toolbar->tooltips = gtk_tooltips_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 |
17260
baaf2cf9339c
disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents:
17259
diff
changeset
|
1364 gtk_box_set_spacing(GTK_BOX(toolbar), 3); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1365 |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1366 gtk_imhtmltoolbar_create_old_buttons(toolbar); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1368 /* Fonts */ |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1369 font_button = gtk_toggle_button_new(); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1370 gtk_button_set_relief(GTK_BUTTON(font_button), GTK_RELIEF_NONE); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1371 bbox = gtk_hbox_new(FALSE, 3); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1372 gtk_container_add(GTK_CONTAINER(font_button), bbox); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1373 image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1374 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1375 label = gtk_label_new_with_mnemonic(_("_Font")); |
18773
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1376 gtk_label_set_use_markup(GTK_LABEL(label), TRUE); |
900b13e40471
Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents:
18766
diff
changeset
|
1377 g_object_set_data(G_OBJECT(hbox), "font_label", label); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1378 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1379 gtk_box_pack_start(GTK_BOX(box), font_button, FALSE, FALSE, 0); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1380 gtk_widget_show_all(font_button); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1382 font_menu = gtk_menu_new(); |
18778
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1383 g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu); |
18004
d40fd7106ebf
merge of '1c5a391126b5b506a29f0b9e34160d239cb783c6'
Sadrul Habib Chowdhury <imadil@gmail.com>
diff
changeset
|
1384 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1385 for (i = 0; buttons[i].label; i++) { |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1386 GtkWidget *old = *buttons[i].button; |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1387 if (buttons[i].check) { |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1388 menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label); |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1389 g_signal_connect_after(G_OBJECT(old), "toggled", |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1390 G_CALLBACK(update_menuitem), menuitem); |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1391 } else { |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1392 menuitem = gtk_menu_item_new_with_mnemonic(buttons[i].label); |
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1393 } |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1394 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1395 G_CALLBACK(gtk_button_clicked), old); |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1396 gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), menuitem); |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1397 g_signal_connect(G_OBJECT(old), "notify::sensitive", |
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1398 G_CALLBACK(button_sensitiveness_changed), menuitem); |
18838
1744f915edb2
Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18802
diff
changeset
|
1399 gtk_container_foreach(GTK_CONTAINER(menuitem), (GtkCallback)enable_markup, NULL); |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1400 } |
18780
c94f1699fdee
Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents:
18778
diff
changeset
|
1401 |
18851
9998470a01de
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18838
diff
changeset
|
1402 g_signal_connect_swapped(G_OBJECT(font_button), "button-press-event", G_CALLBACK(gtk_widget_activate), font_button); |
9998470a01de
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18838
diff
changeset
|
1403 g_signal_connect(G_OBJECT(font_button), "activate", G_CALLBACK(pidgin_menu_clicked), font_menu); |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1404 g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 /* Sep */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1407 sep = gtk_vseparator_new(); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1408 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1409 gtk_widget_show_all(sep); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1410 |
17984
a2c36e2010f1
Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17655
diff
changeset
|
1411 /* Insert */ |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1412 insert_button = gtk_toggle_button_new(); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1413 gtk_button_set_relief(GTK_BUTTON(insert_button), GTK_RELIEF_NONE); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1414 bbox = gtk_hbox_new(FALSE, 3); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1415 gtk_container_add(GTK_CONTAINER(insert_button), bbox); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1416 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1417 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1418 label = gtk_label_new_with_mnemonic(_("_Insert")); |
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1419 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1420 gtk_box_pack_start(GTK_BOX(box), insert_button, FALSE, FALSE, 0); |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1421 gtk_widget_show_all(insert_button); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 |
17549
c1d67fef5eb3
Re-did the toolbar layout to take up less room. This is what we generally agreed to on devel@. I managed to do this, amazingly, not only without breaking Pidgin plugin API compatibility, but it doesn't even add any API. This is still totally raw; I'm comitting it mostly so I can continue it easily from hmoe
Sean Egan <seanegan@gmail.com>
parents:
17421
diff
changeset
|
1423 insert_menu = gtk_menu_new(); |
18778
38bac267bf8e
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 <daniel.atallah@gmail.com>
parents:
18773
diff
changeset
|
1424 g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 |
18167
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1426 menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1427 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1428 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1429 g_signal_connect(G_OBJECT(toolbar->image), "notify::sensitive", |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1430 G_CALLBACK(button_sensitiveness_changed), menuitem); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 |
18167
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1432 menuitem = gtk_menu_item_new_with_mnemonic(_("_Link")); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1433 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1434 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1435 g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive", |
b8b475f31008
Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents:
18166
diff
changeset
|
1436 G_CALLBACK(button_sensitiveness_changed), menuitem); |
17550
425b83d9614d
disapproval of revision '1f2acb75f934f19f04262b06c2907dece2731ed2'
Sean Egan <seanegan@gmail.com>
parents:
17549
diff
changeset
|
1437 |
19469
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
1438 menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule")); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
1439 g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar); |
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
1440 gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24007
diff
changeset
|
1441 toolbar->insert_hr = menuitem; |
19469
42ee8f13c917
Add horizontal rules and strikethroughs to the toolbar
Sean Egan <seanegan@gmail.com>
parents:
18851
diff
changeset
|
1442 |
18851
9998470a01de
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18838
diff
changeset
|
1443 g_signal_connect_swapped(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(gtk_widget_activate), insert_button); |
9998470a01de
The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18838
diff
changeset
|
1444 g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu); |
17655
4d53ccae32b0
Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <stu@nosnilmot.com>
parents:
17549
diff
changeset
|
1445 g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 toolbar->sml = NULL; |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24007
diff
changeset
|
1447 |
20072
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1448 /* Sep */ |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1449 sep = gtk_vseparator_new(); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1450 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1451 gtk_widget_show_all(sep); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1452 |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1453 /* Smiley */ |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1454 smiley_button = gtk_button_new(); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1455 gtk_button_set_relief(GTK_BUTTON(smiley_button), GTK_RELIEF_NONE); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1456 bbox = gtk_hbox_new(FALSE, 3); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1457 gtk_container_add(GTK_CONTAINER(smiley_button), bbox); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1458 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1459 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
20160 | 1460 label = gtk_label_new_with_mnemonic(_("_Smile!")); |
20072
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1461 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1462 gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1463 g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), toolbar->smiley); |
b4708680299e
special case smileys in the toolbar. Fixes #2668 I'll need a new icon from Hylke
Sean Egan <seanegan@gmail.com>
parents:
20041
diff
changeset
|
1464 gtk_widget_show_all(smiley_button); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1465 |
29638
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1466 /* Sep */ |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1467 sep = gtk_vseparator_new(); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1468 gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1469 gtk_widget_show_all(sep); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1470 |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1471 /* Attention */ |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1472 attention_button = gtk_button_new(); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1473 gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1474 bbox = gtk_hbox_new(FALSE, 3); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1475 gtk_container_add(GTK_CONTAINER(attention_button), bbox); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1476 image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1477 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1478 gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1479 label = gtk_label_new_with_mnemonic(_("_Attention!")); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1480 gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1481 gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1482 g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1483 G_CALLBACK(gtk_button_clicked), toolbar->attention); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1484 gtk_widget_show_all(attention_button); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
24007
diff
changeset
|
1485 |
29644
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1486 g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", |
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1487 G_CALLBACK(button_sensitiveness_changed), attention_button); |
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1488 |
29657
146a6c0b2ee8
Gray out attention toolbar button when creating the toolbar.
Marcus Lundblad <ml@update.uu.se>
parents:
29648
diff
changeset
|
1489 /* set attention button to be greyed out until we get a conversation */ |
146a6c0b2ee8
Gray out attention toolbar button when creating the toolbar.
Marcus Lundblad <ml@update.uu.se>
parents:
29648
diff
changeset
|
1490 gtk_widget_set_sensitive(toolbar->attention, FALSE); |
29644
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1491 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1492 gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1493 g_object_set_data(G_OBJECT(hbox), "lean-view", box); |
22093
35d5b7804449
Show the grouped items initially. This fixes the issues with the size of the entry box in the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21971
diff
changeset
|
1494 gtk_widget_show(box); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1495 |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1496 purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1497 imhtmltoolbar_view_pref_changed, toolbar); |
21770
7f79f3099c72
Show either the grouped xor the ungrouped items.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21645
diff
changeset
|
1498 g_signal_connect_data(G_OBJECT(toolbar), "realize", |
7f79f3099c72
Show either the grouped xor the ungrouped items.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21645
diff
changeset
|
1499 G_CALLBACK(purple_prefs_trigger_callback), PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", |
7f79f3099c72
Show either the grouped xor the ungrouped items.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21645
diff
changeset
|
1500 NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1501 |
19982
305c95ea0a7b
Fix from fmoo so that the imhtml toolbar appears right on the MS-Windows theme (and probably other themes too).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19680
diff
changeset
|
1502 #if GTK_CHECK_VERSION(2,4,0) |
305c95ea0a7b
Fix from fmoo so that the imhtml toolbar appears right on the MS-Windows theme (and probably other themes too).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19680
diff
changeset
|
1503 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE); |
305c95ea0a7b
Fix from fmoo so that the imhtml toolbar appears right on the MS-Windows theme (and probably other themes too).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19680
diff
changeset
|
1504 #endif |
305c95ea0a7b
Fix from fmoo so that the imhtml toolbar appears right on the MS-Windows theme (and probably other themes too).
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19680
diff
changeset
|
1505 |
19586
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1506 gtk_widget_add_events(event, GDK_BUTTON_PRESS_MASK); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1507 gtk_box_pack_start(GTK_BOX(hbox), event, TRUE, TRUE, 0); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1508 g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); |
c3259b161070
Add a 'Group Items'/'Ungroup Items' context menu for the toolbar in the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19541
diff
changeset
|
1509 gtk_widget_show(event); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 GtkWidget *gtk_imhtmltoolbar_new() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 return GTK_WIDGET(g_object_new(gtk_imhtmltoolbar_get_type(), NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1517 GType gtk_imhtmltoolbar_get_type() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1519 static GType imhtmltoolbar_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1520 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1521 if (!imhtmltoolbar_type) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1522 static const GTypeInfo imhtmltoolbar_info = { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 sizeof(GtkIMHtmlToolbarClass), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 (GClassInitFunc) gtk_imhtmltoolbar_class_init, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1529 sizeof (GtkIMHtmlToolbar), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 0, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 (GInstanceInitFunc) gtk_imhtmltoolbar_init, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 imhtmltoolbar_type = g_type_register_static(GTK_TYPE_HBOX, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 "GtkIMHtmlToolbar", &imhtmltoolbar_info, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 return imhtmltoolbar_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1543 void gtk_imhtmltoolbar_attach(GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 GtkIMHtmlButtons buttons; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1546 gboolean bold, italic, underline; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 g_return_if_fail(toolbar != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1549 g_return_if_fail(GTK_IS_IMHTMLTOOLBAR(toolbar)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 g_return_if_fail(imhtml != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 g_return_if_fail(GTK_IS_IMHTML(imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1553 toolbar->imhtml = imhtml; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 g_signal_connect(G_OBJECT(imhtml), "format_buttons_update", G_CALLBACK(update_buttons_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle", G_CALLBACK(toggle_button_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 g_signal_connect_after(G_OBJECT(imhtml), "format_function_clear", G_CALLBACK(update_format_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 g_signal_connect(G_OBJECT(imhtml), "format_function_update", G_CALLBACK(update_format_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 g_signal_connect_after(G_OBJECT(GTK_IMHTML(imhtml)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 buttons = gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 update_buttons_cb(GTK_IMHTML(imhtml), buttons, toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), &bold, &italic, &underline); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 update_buttons(toolbar); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 g_free(toolbar->sml); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 toolbar->sml = g_strdup(proto_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 } |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1573 |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1574 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1575 PurpleConversation *conv) |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1576 { |
29644
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1577 PurpleConnection *gc = purple_conversation_get_gc(conv); |
29645
602f3b6ddbbf
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <ml@update.uu.se>
parents:
29644
diff
changeset
|
1578 PurplePlugin *prpl = purple_connection_get_prpl(gc); |
602f3b6ddbbf
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <ml@update.uu.se>
parents:
29644
diff
changeset
|
1579 |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1580 purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n", |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1581 conv); |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1582 toolbar->active_conv = conv; |
29644
0efd688ed086
Added connection flag ALLOW_ATTENTION
Marcus Lundblad <ml@update.uu.se>
parents:
29643
diff
changeset
|
1583 |
29645
602f3b6ddbbf
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <ml@update.uu.se>
parents:
29644
diff
changeset
|
1584 /* gray out attention button on protocols that don't support it |
602f3b6ddbbf
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <ml@update.uu.se>
parents:
29644
diff
changeset
|
1585 for the time being it is always disabled for chats */ |
602f3b6ddbbf
Removed _ALLOW_ATTENTION from connection flags
Marcus Lundblad <ml@update.uu.se>
parents:
29644
diff
changeset
|
1586 gtk_widget_set_sensitive(toolbar->attention, |
29647
12c01afbb0ea
NULL-check for conversation when updating attention button
Marcus Lundblad <ml@update.uu.se>
parents:
29646
diff
changeset
|
1587 conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
12c01afbb0ea
NULL-check for conversation when updating attention button
Marcus Lundblad <ml@update.uu.se>
parents:
29646
diff
changeset
|
1588 PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); |
29643
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1589 } |
bb9f7ba4f299
Added active conversation on GtkIMHtmlToolbar
Marcus Lundblad <ml@update.uu.se>
parents:
29641
diff
changeset
|
1590 |