annotate gtk/gtkscrollbook.c @ 15282:5d53e67c2512

[gaim-migrate @ 18071] updated potfiles.in from Jochen Kemnade committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 04 Jan 2007 17:11:48 +0000
parents cfdd47296dbc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15059
5faea10e1d6f [gaim-migrate @ 17842]
Sean Egan <seanegan@gmail.com>
parents: 15058
diff changeset
2 * @file gtkscrollbook.c GTK+ Scrolling notebook widget
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup gtkui
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * gaim
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "gtkscrollbook.h"
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 static void gtk_gaim_scroll_book_init (GtkGaimScrollBook *scroll_book);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 static void gtk_gaim_scroll_book_class_init (GtkGaimScrollBookClass *klass);
15179
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
31 static void gtk_gaim_scroll_book_forall (GtkContainer *c,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
32 gboolean include_internals,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
33 GtkCallback callback,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
34 gpointer user_data);
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 GType
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 gtk_gaim_scroll_book_get_type (void)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 static GType scroll_book_type = 0;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 if (!scroll_book_type)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 static const GTypeInfo scroll_book_info =
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 sizeof (GtkGaimScrollBookClass),
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 NULL, /* base_init */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 NULL, /* base_finalize */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 (GClassInitFunc) gtk_gaim_scroll_book_class_init,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 NULL, /* class_finalize */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 NULL, /* class_data */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 sizeof (GtkGaimScrollBook),
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 0,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 (GInstanceInitFunc) gtk_gaim_scroll_book_init,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 NULL /* value_table */
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 };
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 scroll_book_type = g_type_register_static(GTK_TYPE_VBOX,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 "GtkGaimScrollBook",
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 &scroll_book_info,
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 return scroll_book_type;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 scroll_left_cb(GtkGaimScrollBook *scroll_book)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 int index;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 if (index > 0)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index - 1);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 scroll_right_cb(GtkGaimScrollBook *scroll_book)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 int index, count;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 #if GTK_CHECK_VERSION(2,2,0)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 #else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 #endif
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 if (index + 1 < count)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index + 1);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 refresh_scroll_box(GtkGaimScrollBook *scroll_book, int index, int count)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 char *label;
15053
51f3c0df6ab4 [gaim-migrate @ 17836]
Mark Doliner <mark@kingant.net>
parents: 15033
diff changeset
95 gtk_widget_show_all(GTK_WIDGET(scroll_book));
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 if (count <= 1)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 gtk_widget_hide(GTK_WIDGET(scroll_book->hbox));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 gtk_widget_show_all(GTK_WIDGET(scroll_book->hbox));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 label = g_strdup_printf("<span size='smaller' weight='bold'>(%d/%d)</span>", index+1, count);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 gtk_label_set_markup(GTK_LABEL(scroll_book->label), label);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 g_free(label);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 if (index == 0)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 gtk_widget_set_sensitive(scroll_book->left_arrow, FALSE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 gtk_widget_set_sensitive(scroll_book->left_arrow, TRUE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 if (index +1== count)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 gtk_widget_set_sensitive(scroll_book->right_arrow, FALSE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 gtk_widget_set_sensitive(scroll_book->right_arrow, TRUE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 static void
15058
f227feab8c78 [gaim-migrate @ 17841]
Sean Egan <seanegan@gmail.com>
parents: 15057
diff changeset
120 page_count_change_cb(GtkGaimScrollBook *scroll_book)
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 {
15182
fbe2187bceec [gaim-migrate @ 17968]
Sean Egan <seanegan@gmail.com>
parents: 15179
diff changeset
122 int count;
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 #if GTK_CHECK_VERSION(2,2,0)
15182
fbe2187bceec [gaim-migrate @ 17968]
Sean Egan <seanegan@gmail.com>
parents: 15179
diff changeset
125 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 #else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 #endif
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 refresh_scroll_box(scroll_book, index, count);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, GtkGaimScrollBook *scroll_book)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 {
15259
cfdd47296dbc [gaim-migrate @ 18048]
Stu Tomlinson <stu@nosnilmot.com>
parents: 15185
diff changeset
136 int count;
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 #if GTK_CHECK_VERSION(2,2,0)
15259
cfdd47296dbc [gaim-migrate @ 18048]
Stu Tomlinson <stu@nosnilmot.com>
parents: 15185
diff changeset
138 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 #else
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 #endif
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 refresh_scroll_box(scroll_book, page_num, count);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 gtk_gaim_scroll_book_add(GtkContainer *container, GtkWidget *widget)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 gtk_widget_show(widget);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 gtk_notebook_append_page(GTK_NOTEBOOK(GTK_GAIM_SCROLL_BOOK(container)->notebook), widget, NULL);
15182
fbe2187bceec [gaim-migrate @ 17968]
Sean Egan <seanegan@gmail.com>
parents: 15179
diff changeset
150 page_count_change_cb(GTK_GAIM_SCROLL_BOOK(container));
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 static void
15179
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
154 gtk_gaim_scroll_book_forall(GtkContainer *container,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
155 gboolean include_internals,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
156 GtkCallback callback,
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
157 gpointer callback_data)
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
158 {
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
159 GtkGaimScrollBook *scroll_book = GTK_GAIM_SCROLL_BOOK(container);
15182
fbe2187bceec [gaim-migrate @ 17968]
Sean Egan <seanegan@gmail.com>
parents: 15179
diff changeset
160 if (include_internals)
15179
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
161 (*callback)(scroll_book->hbox, callback_data);
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
162 (*callback)(scroll_book->notebook, callback_data);
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
163 }
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
164
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
165 static void
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 gtk_gaim_scroll_book_class_init (GtkGaimScrollBookClass *klass)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 GtkContainerClass *container_class = (GtkContainerClass*)klass;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 container_class->add = gtk_gaim_scroll_book_add;
15179
9b2a65069744 [gaim-migrate @ 17965]
Sean Egan <seanegan@gmail.com>
parents: 15129
diff changeset
171 container_class->forall = gtk_gaim_scroll_book_forall;
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 static void
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 gtk_gaim_scroll_book_init (GtkGaimScrollBook *scroll_book)
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 GtkWidget *eb;
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 scroll_book->hbox = gtk_hbox_new(FALSE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 eb = gtk_event_box_new();
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 scroll_book->right_arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 gtk_container_add(GTK_CONTAINER(eb), scroll_book->right_arrow);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_right_cb), scroll_book);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 scroll_book->label = gtk_label_new(NULL);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), scroll_book->label, FALSE, FALSE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 eb = gtk_event_box_new();
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 scroll_book->left_arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 gtk_container_add(GTK_CONTAINER(eb), scroll_book->left_arrow);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_left_cb), scroll_book);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->hbox, FALSE, FALSE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 scroll_book->notebook = gtk_notebook_new();
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 gtk_notebook_set_show_border(GTK_NOTEBOOK(scroll_book->notebook), FALSE);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->notebook, TRUE, TRUE, 0);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
15129
1cf62d550a7a [gaim-migrate @ 17914]
Mark Doliner <mark@kingant.net>
parents: 15059
diff changeset
205 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book);
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book);
15182
fbe2187bceec [gaim-migrate @ 17968]
Sean Egan <seanegan@gmail.com>
parents: 15179
diff changeset
207 gtk_widget_show_all(scroll_book->notebook);
15033
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 }
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 GtkWidget *
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 gtk_gaim_scroll_book_new()
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 {
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 return g_object_new(GTK_GAIM_TYPE_SCROLL_BOOK, NULL);
ca46f41aa433 [gaim-migrate @ 17815]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 }