annotate pidgin/gtkimhtmltoolbar.c @ 19846:5734f1c98a37

Added hints to sametime sametime.c
author Gabriel Schulhof <nix@go-nix.ca>
date Mon, 13 Aug 2007 19:59:39 +0000
parents 9998470a01de
children 42ee8f13c917 c7d4470de3d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
5 * pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
7 * 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
8 * 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
9 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * 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
17 * 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
18 * 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
19 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * 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
22 * along with this program; if not, write to the Free Software
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 *
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 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15510
diff changeset
27 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "imgstore.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #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
32 #include "pidginstock.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "gtkdialogs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "gtkthemes.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "gtkutils.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
17510
8428beecff2f Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17260
diff changeset
40 #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
41
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 static GtkHBoxClass *parent_class = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 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
45 gboolean is_active,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 GtkIMHtmlToolbar *toolbar);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 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
50 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 g_return_if_fail(toolbar != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 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
53 gtk_widget_grab_focus(toolbar->imhtml);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 do_italic(GtkWidget *italic, GtkIMHtmlToolbar *toolbar)
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 g_return_if_fail(toolbar != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 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
61 gtk_widget_grab_focus(toolbar->imhtml);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 do_underline(GtkWidget *underline, GtkIMHtmlToolbar *toolbar)
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 g_return_if_fail(toolbar != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 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
69 gtk_widget_grab_focus(toolbar->imhtml);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 do_small(GtkWidget *smalltb, GtkIMHtmlToolbar *toolbar)
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 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
76 /* 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
77 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
78 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
79 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 do_big(GtkWidget *large, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 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
86 /* 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
87 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
88 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
89 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 destroy_toolbar_font(GtkWidget *widget, GdkEvent *event,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 if (widget != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 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
98
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 if (toolbar->font_dialog != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 gtk_widget_destroy(toolbar->font_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 toolbar->font_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 GtkFontSelection *sel;
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 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
112 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
113 gtk_widget_show_all(sel->family_list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 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
115 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
116 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 cancel_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 destroy_toolbar_font(widget, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 }
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 static void apply_font(GtkWidget *widget, GtkFontSelection *fontsel)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 /* 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
127 but for now only works with font face */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 char *fontname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 char *space;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
130 GtkIMHtmlToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), "purple_toolbar");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
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 space = strrchr(fontname, ' ');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 if(space && isdigit(*(space+1)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 *space = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 gtk_imhtml_toggle_fontface(GTK_IMHTML(toolbar->imhtml), fontname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 g_free(fontname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 cancel_toolbar_font(NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 g_return_if_fail(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 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
150 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
151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 if (!toolbar->font_dialog) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 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
154
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
155 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
156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 if(fontname) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 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
159 g_free(fontname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 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
161 fonttif);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 g_free(fonttif);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 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
165 DEFAULT_FONT_FACE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 }
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_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
169 G_CALLBACK(destroy_toolbar_font), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 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
171 G_CALLBACK(apply_font), toolbar->font_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 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
173 G_CALLBACK(cancel_toolbar_font), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 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
175 G_CALLBACK(realize_toolbar_font), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 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
178 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 cancel_toolbar_font(font, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 GtkIMHtmlToolbar *toolbar)
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 if (widget != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 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
190
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 if (toolbar->fgcolor_dialog != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 gtk_widget_destroy(toolbar->fgcolor_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 toolbar->fgcolor_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 }
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 static void cancel_toolbar_fgcolor(GtkWidget *widget,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 destroy_toolbar_fgcolor(widget, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 }
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 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
205 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 GdkColor text_color;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
207 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
208 char *open_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 open_tag = g_malloc(30);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 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
212 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
213 text_color.red / 256,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 text_color.green / 256,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 text_color.blue / 256);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 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
217 g_free(open_tag);
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 cancel_toolbar_fgcolor(NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *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 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
226 GtkWidget *colorsel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 GdkColor fgcolor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 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
229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 if (!toolbar->fgcolor_dialog) {
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 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
233 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
234 if (color) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 gdk_color_parse(color, &fgcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 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
237 g_free(color);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
240 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
241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 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
243 G_CALLBACK(destroy_toolbar_fgcolor), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 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
245 G_CALLBACK(do_fgcolor), colorsel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 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
247 G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 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
250 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 cancel_toolbar_fgcolor(color, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 if (widget != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 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
262 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
263 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 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
265 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 if (toolbar->bgcolor_dialog != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 gtk_widget_destroy(toolbar->bgcolor_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 toolbar->bgcolor_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 cancel_toolbar_bgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
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 destroy_toolbar_bgcolor(widget, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 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
281 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 GdkColor text_color;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
283 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
284 char *open_tag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 open_tag = g_malloc(30);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 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
288 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
289 text_color.red / 256,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 text_color.green / 256,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 text_color.blue / 256);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 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
293 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
294 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 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
296 g_free(open_tag);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 cancel_toolbar_bgcolor(NULL, 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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 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
305 GtkWidget *colorsel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 GdkColor bgcolor;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 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
308
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 if (!toolbar->bgcolor_dialog) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 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
312 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
313 if (color) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 gdk_color_parse(color, &bgcolor);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 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
316 g_free(color);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
319 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
320
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 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
322 G_CALLBACK(destroy_toolbar_bgcolor), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 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
324 G_CALLBACK(do_bgcolor), colorsel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 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
326 G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 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
330 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 cancel_toolbar_bgcolor(color, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 clear_formatting_cb(GtkWidget *clear, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 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
340 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
341 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
344 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
345 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 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
347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 toolbar->link_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 close_link_dialog(GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 if (toolbar->link_dialog != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
356 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
357 toolbar->link_dialog = NULL;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
362 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
363 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 const char *url, *description;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
366 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
367 if (GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
368 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
369 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 description = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 if (description == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 description = url;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 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
376 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
377 url, description);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 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
380
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 toolbar->link_dialog = NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar)
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 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
388 PurpleRequestFields *fields;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
389 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
390 PurpleRequestField *field;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 GtkTextIter start, end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 char *desc = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
395 fields = purple_request_fields_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
397 group = purple_request_field_group_new(NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
398 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
399
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
400 field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
401 purple_request_field_set_required(field, TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
402 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
403
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 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
405 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
406 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
407 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
408 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
409 desc, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
410 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
411 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
412 "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
413 "is optional."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 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
416 "link that you want to insert."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 toolbar->link_dialog =
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
420 purple_request_fields(toolbar, _("Insert Link"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 msg,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 fields,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 _("_Insert"), G_CALLBACK(do_insert_link_cb),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 _("Cancel"), G_CALLBACK(cancel_link_cb),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16356
diff changeset
426 NULL, NULL, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 g_free(desc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 close_link_dialog(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 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
439 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 gchar *filename, *name, *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 char *filedata;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 size_t size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 GError *error = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 GtkTextIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 GtkTextMark *ins;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 #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
449 if (response != GTK_RESPONSE_ACCEPT) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 #else /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 if (response != GTK_RESPONSE_OK) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 #endif /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 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
454 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 #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
458 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
459 #else /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 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
461 #endif /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 if (filename == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 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
465 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 #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
469 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
470 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 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
472 return;
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 #endif /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 /* 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
477 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
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 if (!g_file_get_contents(filename, &filedata, &size, &error)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
480 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
481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 g_error_free(error);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 name = strrchr(filename, G_DIR_SEPARATOR) + 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489
16375
391a79778f89 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents: 16202
diff changeset
490 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
491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 if (id == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 buf = g_strdup_printf(_("Failed to store image: %s\n"), filename);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
494 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
495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 }
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 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 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
505 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
506 &iter, ins);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 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
508 purple_imgstore_unref_by_id(id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 insert_image_cb(GtkWidget *save, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 GtkWidget *window;
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 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
518 #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
519 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
520 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 GTK_FILE_CHOOSER_ACTION_OPEN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 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
526 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
527 "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
528 #else /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 window = gtk_file_selection_new(_("Insert Image"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 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
531 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
532 "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
533 #endif /* FILECHOOSER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 gtk_widget_show(window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 toolbar->image_dialog = window;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 gtk_widget_destroy(toolbar->image_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 toolbar->image_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 }
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 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 destroy_smiley_dialog(GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 if (toolbar->smiley_dialog != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 gtk_widget_destroy(toolbar->smiley_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 toolbar->smiley_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 close_smiley_dialog(GtkWidget *widget, GdkEvent *event,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 insert_smiley_text(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 char *smiley_text, *escaped_smiley;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 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
570 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
571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 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
573 GTK_IMHTML(toolbar->imhtml)->protocol_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 escaped_smiley);
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 g_free(escaped_smiley);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 close_smiley_dialog(NULL, NULL, toolbar);
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 /* smiley buttons list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 struct smiley_button_list {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 int width, height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 GtkWidget *button;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 struct smiley_button_list *next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 static struct smiley_button_list *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, int *width, char *filename, char *face)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 GtkWidget *image;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 GtkWidget *button;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 GtkRequisition size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 struct smiley_button_list *cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 struct smiley_button_list *it, *it_last;
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 cur = malloc(sizeof(struct smiley_button_list));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 it = ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 it_last = ls; /* list iterators*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 image = gtk_image_new_from_file(filename);
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 gtk_widget_size_request(image, &size);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 (*width) += size.width;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 button = gtk_button_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 gtk_container_add(GTK_CONTAINER(button), image);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 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
609 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
610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 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
612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 /* these look really weird with borders */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 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
615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 /* set current element to add */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 cur->height = size.height;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 cur->width = size.width;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 cur->button = button;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 cur->next = ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 /* check where to insert by height */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 if (ls == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 return cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 while (it != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 it_last = it;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 it = it->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 cur->next = it;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 it_last->next = cur;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 return ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 while (list) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 GtkIMHtmlSmiley *cur = list->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 if (!strcmp(cur->file, smiley->file))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 list = list->next;
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 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645
17510
8428beecff2f Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17260
diff changeset
646 static gboolean
8428beecff2f Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17260
diff changeset
647 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
648 {
18388
ec29522b76d0 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents: 18387
diff changeset
649 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
650 (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
651 {
ec29522b76d0 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents: 18387
diff changeset
652 close_smiley_dialog(NULL, NULL, toolbar);
ec29522b76d0 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents: 18387
diff changeset
653 return TRUE;
ec29522b76d0 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents: 18387
diff changeset
654 }
17510
8428beecff2f Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17260
diff changeset
655
18388
ec29522b76d0 Rework the logic to be (IMHO) easy to read.
Richard Laager <rlaager@wiktel.com>
parents: 18387
diff changeset
656 return FALSE;
17510
8428beecff2f Close smiley dialog on GDK_Escape or button 1 press.
Gabriel Schulhof <nix@go-nix.ca>
parents: 17260
diff changeset
657 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 GtkWidget *dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 GtkWidget *smiley_table = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 GSList *smileys, *unique_smileys = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 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
667 destroy_smiley_dialog(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 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
673 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
674 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
675 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
676
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 while(smileys) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 GtkIMHtmlSmiley *smiley = smileys->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 if(!smiley->hidden) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 if(smiley_is_unique(unique_smileys, smiley))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 unique_smileys = g_slist_append(unique_smileys, smiley);
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 smileys = smileys->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
15510
567a499c3b06 dialogs
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
686 PIDGIN_DIALOG(dialog);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691
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
692 if (unique_smileys != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 struct smiley_button_list *ls, *it, *it_tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 GtkWidget *line;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 int line_width = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 int max_line_width, num_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 int col=0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 /* We use hboxes packed in a vbox */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 ls = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 line = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 line_width = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 max_line_width = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 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
705 smiley_table = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 /* create list of smileys sorted by height */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 while (unique_smileys) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 GtkIMHtmlSmiley *smiley = unique_smileys->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 if (!smiley->hidden) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 fflush(stdout);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 ls = sort_smileys(ls, toolbar, &max_line_width, smiley->file, smiley->smile);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 unique_smileys = unique_smileys->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 /* pack buttons of the list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 max_line_width = max_line_width / num_lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 it = ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 while (it != NULL)
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 it_tmp = it;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 gtk_box_pack_start(GTK_BOX(line), it->button, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 gtk_widget_show(it->button);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 line_width += it->width;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 if (line_width >= max_line_width) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 line = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 line_width = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 col = 0;
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 col++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 it = it->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 free(it_tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 gtk_box_pack_start(GTK_BOX(smiley_table), line, FALSE, TRUE, 0);
18389
0ef0b2ead713 Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents: 18388
diff changeset
736
0ef0b2ead713 Rework the smiley dialog close logic: Escape will always close the window.
Richard Laager <rlaager@wiktel.com>
parents: 18388
diff changeset
737 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
738 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 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
741 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
742 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
743 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744
17514
7c021dd8efdf Forgot to remove spaces from before ;s
Gabriel Schulhof <nix@go-nix.ca>
parents: 17513
diff changeset
745 g_signal_connect(G_OBJECT(dialog), "key-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
746 gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 gtk_widget_show(smiley_table);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 /* connect signals */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 g_signal_connect(G_OBJECT(dialog), "delete_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 G_CALLBACK(close_smiley_dialog), toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 /* show everything */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 gtk_widget_show_all(dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 toolbar->smiley_dialog = dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 gtk_widget_grab_focus(toolbar->imhtml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 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
766 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 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
768 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
769 gtk_widget_set_sensitive(GTK_WIDGET(toolbar->underline), buttons & GTK_IMHTML_UNDERLINE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 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
772 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
773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 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
775 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
776 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
777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 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
779 (buttons & GTK_IMHTML_BOLD ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 buttons & GTK_IMHTML_ITALIC ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 buttons & GTK_IMHTML_UNDERLINE ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 buttons & GTK_IMHTML_GROW ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 buttons & GTK_IMHTML_SHRINK ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 buttons & GTK_IMHTML_FACE ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 buttons & GTK_IMHTML_FORECOLOR ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 buttons & GTK_IMHTML_BACKCOLOR));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 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
789 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
790 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
791 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 /* 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
794 * 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
795 * do the double toggling hack
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 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
798 gboolean is_active,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 GObject *object;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 g_return_if_fail(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 object = g_object_ref(button);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 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
806 0, 0, NULL, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 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
808 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
809 0, 0, NULL, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 g_object_unref(object);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
813 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
814 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 gboolean bold, italic, underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 char *tmp2;
18773
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
818 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
819
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
820 gtk_label_set_label(label, _("_Font"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 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
823 &bold, &italic, &underline);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 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
826 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
827 toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 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
829 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
830 toolbar);
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 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
833 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
834 underline, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 /* These buttons aren't ever "active". */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 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
838 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
839
18773
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
840 if (bold) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
841 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
842 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
843 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
844 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
845 }
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
846 if (italic) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
847 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
848 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
849 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
850 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
851 }
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
852 if (underline) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
853 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
854 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
855 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
856 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
857 }
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
858
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 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
860 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
861 (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
862 if (tmp != NULL) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
863 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
864 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
865 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
866 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
867 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 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
871 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
872 (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
873 if (tmp != NULL) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
874 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
875 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
876 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
877 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
878 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 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
882 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
883 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
884 (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
885 if (tmp != NULL) {
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
886 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
887 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
888 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
889 g_free(markup);
900b13e40471 Show current outgoing conversation formatting on the font label on
Ka-Hing Cheung <khc@hxbc.us>
parents: 18766
diff changeset
890 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 g_free(tmp2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 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
896 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 update_buttons(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 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
901 update_buttons(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 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
905 GtkTextMark *mark, GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 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
908 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 update_buttons(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912
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
913
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
914 /* 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
915 * 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
916 * 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
917 */
17655
4d53ccae32b0 Fix a compile error and kill a bucket full of compile warnings
Stu Tomlinson <stu@nosnilmot.com>
parents: 17549
diff changeset
918 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
919 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
920 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
921 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
922 gboolean *push_in,
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
923 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
924 {
18166
afeb35205669 Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents: 18113
diff changeset
925 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
926 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
927 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
928 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
929
18166
afeb35205669 Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents: 18113
diff changeset
930 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
931 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
932 *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
933 *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
934 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
935
18166
afeb35205669 Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents: 18113
diff changeset
936 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
937
afeb35205669 Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <stu@nosnilmot.com>
parents: 18113
diff changeset
938 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
939 *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
940 }
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
941
18851
9998470a01de The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18838
diff changeset
942 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
943 {
18802
5a5ca6438308 show toolbar menu on button press, rather than button release. Fixes #2352
Sean Egan <seanegan@gmail.com>
parents: 18794
diff changeset
944 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
945 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
946 }
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
947
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
948 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
949 {
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
950 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
951 }
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
952
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 enum {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 LAST_SIGNAL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 /* static guint signals [LAST_SIGNAL] = { 0 }; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 gtk_imhtmltoolbar_finalize (GObject *object)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 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
962 GtkWidget *menu;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 if (toolbar->image_dialog != NULL)
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 gtk_widget_destroy(toolbar->image_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 toolbar->image_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 destroy_toolbar_font(NULL, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 destroy_smiley_dialog(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 destroy_toolbar_bgcolor(NULL, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 destroy_toolbar_fgcolor(NULL, NULL, toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 close_link_dialog(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 if (toolbar->imhtml) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 g_signal_handlers_disconnect_matched(toolbar->imhtml,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 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
978 toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 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
980 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
981 toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 free(toolbar->sml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986
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
987 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
988 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
989 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
990 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
991 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
992 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
993
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 G_OBJECT_CLASS(parent_class)->finalize (object);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 /* Boring GTK+ stuff */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 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
999 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 GtkObjectClass *object_class;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 GObjectClass *gobject_class;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 object_class = (GtkObjectClass*) class;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 gobject_class = (GObjectClass*) class;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 parent_class = gtk_type_class(GTK_TYPE_HBOX);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 gobject_class->finalize = gtk_imhtmltoolbar_finalize;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007
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
1008 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
1009 {
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
1010 GtkWidget *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
1011 /* Bold */
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
1012 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_BOLD);
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
1013 g_signal_connect(G_OBJECT(button), "clicked",
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
1014 G_CALLBACK(do_bold), 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
1015 toolbar->bold = 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
1016
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
1017
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
1018 /* Italic */
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
1019 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_ITALIC);
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
1020 g_signal_connect(G_OBJECT(button), "clicked",
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
1021 G_CALLBACK(do_italic), 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
1022 toolbar->italic = 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
1023
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
1024 /* Underline */
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
1025 button = pidgin_pixbuf_toolbar_button_from_stock(GTK_STOCK_UNDERLINE);
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
1026 g_signal_connect(G_OBJECT(button), "clicked",
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
1027 G_CALLBACK(do_underline), 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
1028 toolbar->underline = 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
1029
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
1030 /* Increase font size */
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
1031 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_TEXT_LARGER);
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
1032 g_signal_connect(G_OBJECT(button), "clicked",
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
1033 G_CALLBACK(do_big), 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
1034 toolbar->larger_size = 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
1035
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
1036 /* Decrease font size */
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
1037 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER);
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
1038 g_signal_connect(G_OBJECT(button), "clicked",
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
1039 G_CALLBACK(do_small), 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
1040 toolbar->smaller_size = 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
1041
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
1042 /* Font Face */
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
1043
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
1044 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_FONT_FACE);
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
1045 g_signal_connect(G_OBJECT(button), "clicked",
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
1046 G_CALLBACK(toggle_font), 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
1047 toolbar->font = 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
1048
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
1049 /* Foreground Color */
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
1050 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_FGCOLOR);
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
1051 g_signal_connect(G_OBJECT(button), "clicked",
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
1052 G_CALLBACK(toggle_fg_color), 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
1053 toolbar->fgcolor = 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
1054
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
1055 /* Background Color */
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
1056 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_BGCOLOR);
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
1057 g_signal_connect(G_OBJECT(button), "clicked",
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
1058 G_CALLBACK(toggle_bg_color), 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
1059 toolbar->bgcolor = 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
1060
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
1061 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT_LINK);
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
1062 g_signal_connect(G_OBJECT(button), "clicked",
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
1063 G_CALLBACK(insert_link_cb), 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
1064 toolbar->link = 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
1065
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
1066 /* Insert IM 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
1067 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT_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
1068 g_signal_connect(G_OBJECT(button), "clicked",
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
1069 G_CALLBACK(insert_image_cb), 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
1070 toolbar->image = 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
1071
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
1072 /* Insert Smiley */
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
1073 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY);
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
1074 g_signal_connect(G_OBJECT(button), "clicked",
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
1075 G_CALLBACK(insert_smiley_cb), 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
1076 toolbar->smiley = button;
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1077
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1078 /* Reset formatting */
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1079 button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY);
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1080 g_signal_connect(G_OBJECT(button), "clicked",
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1081 G_CALLBACK(clear_formatting_cb), toolbar);
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1082 toolbar->clear = button;
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1083 }
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
1084
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1085 static void
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1086 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
1087 {
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1088 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
1089 }
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
1090
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1091 static void
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1092 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
1093 {
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1094 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
1095 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
1096 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
1097 }
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
18838
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1099 static void
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1100 enable_markup(GtkWidget *widget, gpointer null)
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1101 {
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1102 if (GTK_IS_LABEL(widget))
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1103 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
1104 }
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1105
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108 GtkWidget *hbox = GTK_WIDGET(toolbar);
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
1109 GtkWidget *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
1110 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
1111 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
1112 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
1113 GtkWidget *font_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
1114 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
1115 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
1116 GtkWidget *menuitem;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 GtkWidget *sep;
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1118 int i;
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1119 struct {
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1120 const char *label;
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1121 GtkWidget **button;
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1122 gboolean check;
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1123 } buttons[] = {
18838
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1124 {_("<b>_Bold</b>"), &toolbar->bold, TRUE},
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1125 {_("<i>_Italic</i>"), &toolbar->italic, TRUE},
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1126 {_("<u>_Underline</u>"), &toolbar->underline, TRUE},
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1127 {_("<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
1128 #if 0
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1129 {_("_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
1130 #endif
18838
1744f915edb2 Show formatting in the font dropdown menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18802
diff changeset
1131 {_("<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
1132 /* 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
1133 * 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
1134 * no updating nor nothin' */
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1135 {_("_Font face"), &toolbar->font, TRUE},
18792
b193b5921665 I thought I fixed this already...
Kevin Stange <kevin@simguy.net>
parents: 18780
diff changeset
1136 {_("Foreground _color"), &toolbar->fgcolor, TRUE},
18793
4e46e5f6586a Another mnemonic conflict
Kevin Stange <kevin@simguy.net>
parents: 18792
diff changeset
1137 {_("Bac_kground color"), &toolbar->bgcolor, TRUE},
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1138 {_("_Reset formatting"), &toolbar->clear, FALSE},
18789
09082badaa46 Get rid of two minor compile warnings:
Mark Doliner <mark@kingant.net>
parents: 18780
diff changeset
1139 {NULL, NULL, FALSE}
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1140 };
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1141
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 toolbar->imhtml = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 toolbar->font_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145 toolbar->fgcolor_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 toolbar->bgcolor_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 toolbar->link_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 toolbar->smiley_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 toolbar->image_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 toolbar->tooltips = gtk_tooltips_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152
17260
baaf2cf9339c disapproval of revision '1f819f5ad330efa81ac7906f854b46f0c8bbd7b6'
Ethan Blanton <elb@pidgin.im>
parents: 17259
diff changeset
1153 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
1154
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
1155 gtk_imhtmltoolbar_create_old_buttons(toolbar);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1157 /* 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
1158 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
1159 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
1160 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
1161 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
1162 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
1163 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
1164 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
1165 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
1166 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
1167 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1168 gtk_box_pack_start(GTK_BOX(hbox), font_button, 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
1169 gtk_widget_show_all(font_button);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170
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
1171 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
1172 g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu);
18004
d40fd7106ebf merge of '1c5a391126b5b506a29f0b9e34160d239cb783c6'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17751 17984
diff changeset
1173
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1174 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
1175 GtkWidget *old = *buttons[i].button;
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1176 if (buttons[i].check) {
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1177 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
1178 g_signal_connect_after(G_OBJECT(old), "toggled",
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1179 G_CALLBACK(update_menuitem), menuitem);
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1180 } else {
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1181 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
1182 }
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1183 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
1184 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
1185 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
1186 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
1187 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
1188 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
1189 }
18780
c94f1699fdee Move 'Reset formatting' to Font dropdown
Sean Egan <seanegan@gmail.com>
parents: 18778
diff changeset
1190
18851
9998470a01de The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18838
diff changeset
1191 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
1192 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
1193 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
1194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 /* Sep */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196 sep = gtk_vseparator_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 gtk_box_pack_start(GTK_BOX(hbox), 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
1198 gtk_widget_show_all(sep);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199
17984
a2c36e2010f1 Fix some stuff of bugs in the new toolbar.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17655
diff changeset
1200 /* 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
1201 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
1202 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
1203 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
1204 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
1205 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
1206 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
1207 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
1208 gtk_box_pack_start(GTK_BOX(bbox), label, 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
1209 gtk_box_pack_start(GTK_BOX(hbox), insert_button, 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
1210 gtk_widget_show_all(insert_button);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211
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
1212 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
1213 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
1214
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18166
diff changeset
1215 menuitem = gtk_menu_item_new_with_mnemonic(_("_Smiley"));
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18166
diff changeset
1216 g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->smiley);
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18166
diff changeset
1217 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
1218 g_signal_connect(G_OBJECT(toolbar->smiley), "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
1219 G_CALLBACK(button_sensitiveness_changed), menuitem);
17550
425b83d9614d disapproval of revision '1f2acb75f934f19f04262b06c2907dece2731ed2'
Sean Egan <seanegan@gmail.com>
parents: 17549
diff changeset
1220
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18166
diff changeset
1221 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
1222 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
1223 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
1224 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
1225 G_CALLBACK(button_sensitiveness_changed), menuitem);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226
18167
b8b475f31008 Fix setting the sensitivity of the toolbar items in a number of places
Stu Tomlinson <stu@nosnilmot.com>
parents: 18166
diff changeset
1227 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
1228 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
1229 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
1230 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
1231 G_CALLBACK(button_sensitiveness_changed), menuitem);
17550
425b83d9614d disapproval of revision '1f2acb75f934f19f04262b06c2907dece2731ed2'
Sean Egan <seanegan@gmail.com>
parents: 17549
diff changeset
1232
18851
9998470a01de The hotkeys should popup the menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18838
diff changeset
1233 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
1234 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
1235 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
1236 toolbar->sml = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 GtkWidget *gtk_imhtmltoolbar_new()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 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
1242 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 GType gtk_imhtmltoolbar_get_type()
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 static GType imhtmltoolbar_type = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 if (!imhtmltoolbar_type) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 static const GTypeInfo imhtmltoolbar_info = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 sizeof(GtkIMHtmlToolbarClass),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 (GClassInitFunc) gtk_imhtmltoolbar_class_init,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 sizeof (GtkIMHtmlToolbar),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 (GInstanceInitFunc) gtk_imhtmltoolbar_init,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 NULL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 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
1263 "GtkIMHtmlToolbar", &imhtmltoolbar_info, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 return imhtmltoolbar_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 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
1271 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 GtkIMHtmlButtons buttons;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273 gboolean bold, italic, underline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275 g_return_if_fail(toolbar != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 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
1277 g_return_if_fail(imhtml != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 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
1279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 toolbar->imhtml = imhtml;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 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
1282 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
1283 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
1284 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
1285 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
1286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287 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
1288 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
1289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 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
1291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 update_buttons(toolbar);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 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
1296 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 g_free(toolbar->sml);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298 toolbar->sml = g_strdup(proto_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 }