annotate pidgin/gtkscrollbook.c @ 29326:89bece95a522

We were using this formula from before the documentation was public, and for some reason I think it's a good idea for this comment to not indicate that we got the formula from the documentation
author Mark Doliner <mark@kingant.net>
date Tue, 02 Feb 2010 23:44:33 +0000
parents 2f88870f86bf
children 21277e69e06c
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 /*
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
2 * @file gtkscrollbook.c GTK+ Scrolling notebook widget
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 15871
diff changeset
3 * @ingroup pidgin
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16193
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "gtkscrollbook.h"
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
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
30 static void pidgin_scroll_book_init (PidginScrollBook *scroll_book);
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
31 static void pidgin_scroll_book_class_init (PidginScrollBookClass *klass);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
32 static void pidgin_scroll_book_forall (GtkContainer *c,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 gboolean include_internals,
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
34 GtkCallback callback,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 gpointer user_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 GType
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
38 pidgin_scroll_book_get_type (void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 static GType scroll_book_type = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 if (!scroll_book_type)
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 const GTypeInfo scroll_book_info =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 {
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
46 sizeof (PidginScrollBookClass),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 NULL, /* base_init */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 NULL, /* base_finalize */
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
49 (GClassInitFunc) pidgin_scroll_book_class_init,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 NULL, /* class_finalize */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 NULL, /* class_data */
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
52 sizeof (PidginScrollBook),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 0,
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
54 (GInstanceInitFunc) pidgin_scroll_book_init,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 NULL /* value_table */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 scroll_book_type = g_type_register_static(GTK_TYPE_VBOX,
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
59 "PidginScrollBook",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 &scroll_book_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 0);
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 return scroll_book_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
67 static gboolean
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
68 scroll_left_cb(PidginScrollBook *scroll_book)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 int index;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 if (index > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index - 1);
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
75 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
78 static gboolean
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
79 scroll_right_cb(PidginScrollBook *scroll_book)
15374
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 int index, count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
87 #endif
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
88
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 if (index + 1 < count)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index + 1);
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
91 return TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
95 refresh_scroll_box(PidginScrollBook *scroll_book, int index, int count)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 char *label;
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
98
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 gtk_widget_show_all(GTK_WIDGET(scroll_book));
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
100 if (count < 1)
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
101 gtk_widget_hide_all(scroll_book->hbox);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
102 else {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
103 gtk_widget_show_all(scroll_book->hbox);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
104 if (count == 1) {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
105 gtk_widget_hide(scroll_book->label);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
106 gtk_widget_hide(scroll_book->left_arrow);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
107 gtk_widget_hide(scroll_book->right_arrow);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
108 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
109 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
110
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 label = g_strdup_printf("<span size='smaller' weight='bold'>(%d/%d)</span>", index+1, count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 gtk_label_set_markup(GTK_LABEL(scroll_book->label), label);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
113 g_free(label);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 if (index == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 gtk_widget_set_sensitive(scroll_book->left_arrow, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 gtk_widget_set_sensitive(scroll_book->left_arrow, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
120
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
121 if (index + 1 == count)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 gtk_widget_set_sensitive(scroll_book->right_arrow, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 gtk_widget_set_sensitive(scroll_book->right_arrow, TRUE);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
129 page_count_change_cb(PidginScrollBook *scroll_book)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 int count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 refresh_scroll_box(scroll_book, index, count);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
139 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
140
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
141 static gboolean
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
142 scroll_close_cb(PidginScrollBook *scroll_book)
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
143 {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
144 gtk_widget_destroy(gtk_notebook_get_nth_page(GTK_NOTEBOOK(scroll_book->notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook))));
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21644
diff changeset
145 return FALSE;
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
149 switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, PidginScrollBook *scroll_book)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 int count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 #if GTK_CHECK_VERSION(2,2,0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 refresh_scroll_box(scroll_book, page_num, count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
161 pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 {
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
163 PidginScrollBook *scroll_book;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
164
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
165 g_return_if_fail(GTK_IS_WIDGET (widget));
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
166 g_return_if_fail (widget->parent == NULL);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
167
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
168 scroll_book = PIDGIN_SCROLL_BOOK(container);
21639
fa5d1f426332 I'm pretty sure this is what was intended.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21583
diff changeset
169 scroll_book->children = g_list_append(scroll_book->children, widget);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 gtk_widget_show(widget);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
171 gtk_notebook_append_page(GTK_NOTEBOOK(scroll_book->notebook), widget, NULL);
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
172 page_count_change_cb(PIDGIN_SCROLL_BOOK(container));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 static void
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
176 pidgin_scroll_book_remove(GtkContainer *container, GtkWidget *widget)
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
177 {
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
178 int page;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
179 PidginScrollBook *scroll_book;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
180 g_return_if_fail(GTK_IS_WIDGET(widget));
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
181
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
182 scroll_book = PIDGIN_SCROLL_BOOK(container);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
183 scroll_book->children = g_list_remove(scroll_book->children, widget);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
184 /* gtk_widget_unparent(widget); */
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
185
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
186 page = gtk_notebook_page_num(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
187 if (page >= 0) {
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
188 gtk_notebook_remove_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), page);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
189 }
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
190 }
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
191
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
192 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
193 pidgin_scroll_book_forall(GtkContainer *container,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 gboolean include_internals,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 GtkCallback callback,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 gpointer callback_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 {
21641
ee7638c696f1 My previous commit caused the scrollbook's children to be tracked correctly - it turns out that this causes problems because they really aren't the children of the scrollbook, they're the notebook'children. This stuff needs to be revisited.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21639
diff changeset
198 #if 0
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
199 GList *children;
21641
ee7638c696f1 My previous commit caused the scrollbook's children to be tracked correctly - it turns out that this causes problems because they really aren't the children of the scrollbook, they're the notebook'children. This stuff needs to be revisited.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21639
diff changeset
200 #endif
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
201 PidginScrollBook *scroll_book;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
202
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
203 g_return_if_fail(GTK_IS_CONTAINER(container));
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
204
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
205 scroll_book = PIDGIN_SCROLL_BOOK(container);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
206
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
207 if (include_internals) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 (*callback)(scroll_book->hbox, callback_data);
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
209 (*callback)(scroll_book->notebook, callback_data);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
210 }
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
211
21641
ee7638c696f1 My previous commit caused the scrollbook's children to be tracked correctly - it turns out that this causes problems because they really aren't the children of the scrollbook, they're the notebook'children. This stuff needs to be revisited.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21639
diff changeset
212 #if 0
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
213 children = scroll_book->children;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
214
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
215 while (children) {
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
216 GtkWidget *child;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
217 child = children->data;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
218 children = children->next;
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
219 (*callback)(child, callback_data);
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
220 }
21641
ee7638c696f1 My previous commit caused the scrollbook's children to be tracked correctly - it turns out that this causes problems because they really aren't the children of the scrollbook, they're the notebook'children. This stuff needs to be revisited.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21639
diff changeset
221 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
225 pidgin_scroll_book_class_init (PidginScrollBookClass *klass)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 GtkContainerClass *container_class = (GtkContainerClass*)klass;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
229 container_class->add = pidgin_scroll_book_add;
21583
21cbdaf265f6 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <stu@nosnilmot.com>
parents: 20074
diff changeset
230 container_class->remove = pidgin_scroll_book_remove;
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
231 container_class->forall = pidgin_scroll_book_forall;
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
232 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
233
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
234 static gboolean
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
235 close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
236 {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
237 static GdkCursor *ptr = NULL;
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
238 if (ptr == NULL) {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
239 ptr = gdk_cursor_new(GDK_LEFT_PTR);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
240 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
241
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
242 gtk_label_set_markup(label, "×");
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
243 gdk_window_set_cursor(event->window, ptr);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
244 return FALSE;
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
245 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
246
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
247 static gboolean
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
248 close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
249 {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
250 static GdkCursor *hand = NULL;
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
251 if (hand == NULL) {
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
252 hand = gdk_cursor_new(GDK_HAND2);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
253 }
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
254
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
255 gtk_label_set_markup(label, "<u>×</u>");
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
256 gdk_window_set_cursor(event->window, hand);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
257 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 }
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 static void
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
261 pidgin_scroll_book_init (PidginScrollBook *scroll_book)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 GtkWidget *eb;
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
264 GtkWidget *close_button;
15374
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 scroll_book->hbox = gtk_hbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
268 /* Close */
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
269 eb = gtk_event_box_new();
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
270 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
22489
2f88870f86bf gtk_event_box_set_visible_window() is new in Gtk 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 21913
diff changeset
271 #if GTK_CHECK_VERSION(2,4,0)
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
272 gtk_event_box_set_visible_window(GTK_EVENT_BOX(eb), FALSE);
22489
2f88870f86bf gtk_event_box_set_visible_window() is new in Gtk 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 21913
diff changeset
273 #endif
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
274 gtk_widget_set_events(eb, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
275 close_button = gtk_label_new("×");
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
276 g_signal_connect(G_OBJECT(eb), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_button);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
277 g_signal_connect(G_OBJECT(eb), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_button);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
278 gtk_container_add(GTK_CONTAINER(eb), close_button);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
279 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_close_cb), scroll_book);
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
280
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
281 /* Right arrow */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 eb = gtk_event_box_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 scroll_book->right_arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 gtk_container_add(GTK_CONTAINER(eb), scroll_book->right_arrow);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_right_cb), scroll_book);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
288 /* Count */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 scroll_book->label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), scroll_book->label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
292 /* Left arrow */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 eb = gtk_event_box_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 scroll_book->left_arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 gtk_container_add(GTK_CONTAINER(eb), scroll_book->left_arrow);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_left_cb), scroll_book);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->hbox, FALSE, FALSE, 0);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
300
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 scroll_book->notebook = gtk_notebook_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 gtk_notebook_set_show_border(GTK_NOTEBOOK(scroll_book->notebook), FALSE);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
304
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->notebook, TRUE, TRUE, 0);
21644
6018f0ba6aca Patch from DB42 to add a little '¡ß' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21641
diff changeset
306
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 gtk_widget_show_all(scroll_book->notebook);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 GtkWidget *
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
313 pidgin_scroll_book_new()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 {
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
315 return g_object_new(PIDGIN_TYPE_SCROLL_BOOK, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 }