Thu, 04 Feb 2010 05:30:35 +0000
propagate from branch 'im.pidgin.pidgin' (head 3180b88b4c1b8e73c22589457b99d2c1b6096bf4)
to branch 'im.pidgin.pidgin.next.minor' (head 1507ce18860b4a4481751cda84af9a334bfff934)
| 15094 | 1 | /* |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
2 | * @file gtkscrollbook.c GTK+ Scrolling notebook widget |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
15931
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 15094 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 15094 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 11 | * | |
| 12 | * This program is free software; you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16254
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 15094 | 25 | */ |
| 26 | ||
| 27 | #include "gtkscrollbook.h" | |
| 28 | ||
| 29 | ||
| 15577 | 30 | static void pidgin_scroll_book_init (PidginScrollBook *scroll_book); |
| 31 | static void pidgin_scroll_book_class_init (PidginScrollBookClass *klass); | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
32 | static void pidgin_scroll_book_forall (GtkContainer *c, |
| 15240 | 33 | gboolean include_internals, |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
34 | GtkCallback callback, |
| 15240 | 35 | gpointer user_data); |
| 15094 | 36 | |
| 37 | GType | |
| 15577 | 38 | pidgin_scroll_book_get_type (void) |
| 15094 | 39 | { |
| 40 | static GType scroll_book_type = 0; | |
| 41 | ||
| 42 | if (!scroll_book_type) | |
| 43 | { | |
| 44 | static const GTypeInfo scroll_book_info = | |
| 45 | { | |
| 15577 | 46 | sizeof (PidginScrollBookClass), |
| 15094 | 47 | NULL, /* base_init */ |
| 48 | NULL, /* base_finalize */ | |
| 15577 | 49 | (GClassInitFunc) pidgin_scroll_book_class_init, |
| 15094 | 50 | NULL, /* class_finalize */ |
| 51 | NULL, /* class_data */ | |
| 15577 | 52 | sizeof (PidginScrollBook), |
| 15094 | 53 | 0, |
| 15577 | 54 | (GInstanceInitFunc) pidgin_scroll_book_init, |
| 15094 | 55 | NULL /* value_table */ |
| 56 | }; | |
| 57 | ||
| 58 | scroll_book_type = g_type_register_static(GTK_TYPE_VBOX, | |
| 15577 | 59 | "PidginScrollBook", |
| 15094 | 60 | &scroll_book_info, |
| 61 | 0); | |
| 62 | } | |
| 63 | ||
| 64 | return scroll_book_type; | |
| 65 | } | |
| 66 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
67 | static gboolean |
| 15577 | 68 | scroll_left_cb(PidginScrollBook *scroll_book) |
| 15094 | 69 | { |
| 70 | int index; | |
| 71 | index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); | |
| 72 | ||
| 73 | if (index > 0) | |
| 74 | gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index - 1); | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
75 | return TRUE; |
| 15094 | 76 | } |
| 77 | ||
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
78 | static gboolean |
| 15577 | 79 | scroll_right_cb(PidginScrollBook *scroll_book) |
| 15094 | 80 | { |
| 81 | int index, count; | |
| 82 | index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); | |
| 83 | count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
84 | |
| 15094 | 85 | if (index + 1 < count) |
| 86 | gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index + 1); | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
87 | return TRUE; |
| 15094 | 88 | } |
| 89 | ||
| 90 | static void | |
| 15577 | 91 | refresh_scroll_box(PidginScrollBook *scroll_book, int index, int count) |
| 15094 | 92 | { |
| 93 | char *label; | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
94 | |
|
15114
4224e5db3ee4
[gaim-migrate @ 17836]
Mark Doliner <markdoliner@pidgin.im>
parents:
15094
diff
changeset
|
95 | gtk_widget_show_all(GTK_WIDGET(scroll_book)); |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
96 | if (count < 1) |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
97 | gtk_widget_hide_all(scroll_book->hbox); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
98 | else { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
99 | gtk_widget_show_all(scroll_book->hbox); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
100 | if (count == 1) { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
101 | gtk_widget_hide(scroll_book->label); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
102 | gtk_widget_hide(scroll_book->left_arrow); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
103 | gtk_widget_hide(scroll_book->right_arrow); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
104 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
105 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
106 | |
| 15094 | 107 | label = g_strdup_printf("<span size='smaller' weight='bold'>(%d/%d)</span>", index+1, count); |
| 108 | gtk_label_set_markup(GTK_LABEL(scroll_book->label), label); | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
109 | g_free(label); |
| 15094 | 110 | |
| 111 | if (index == 0) | |
| 112 | gtk_widget_set_sensitive(scroll_book->left_arrow, FALSE); | |
| 113 | else | |
| 114 | gtk_widget_set_sensitive(scroll_book->left_arrow, TRUE); | |
| 115 | ||
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
116 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
117 | if (index + 1 == count) |
| 15094 | 118 | gtk_widget_set_sensitive(scroll_book->right_arrow, FALSE); |
| 119 | else | |
| 120 | gtk_widget_set_sensitive(scroll_book->right_arrow, TRUE); | |
| 121 | } | |
| 122 | ||
| 123 | ||
| 124 | static void | |
| 15577 | 125 | page_count_change_cb(PidginScrollBook *scroll_book) |
| 15094 | 126 | { |
| 15243 | 127 | int count; |
| 15094 | 128 | int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); |
| 15243 | 129 | count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); |
| 15094 | 130 | refresh_scroll_box(scroll_book, index, count); |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
131 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
132 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
133 | static gboolean |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
134 | scroll_close_cb(PidginScrollBook *scroll_book) |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
135 | { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
136 | gtk_widget_destroy(gtk_notebook_get_nth_page(GTK_NOTEBOOK(scroll_book->notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)))); |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21763
diff
changeset
|
137 | return FALSE; |
| 15094 | 138 | } |
| 139 | ||
| 140 | static void | |
| 15577 | 141 | switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, PidginScrollBook *scroll_book) |
| 15094 | 142 | { |
|
15320
c4eea0409712
[gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15246
diff
changeset
|
143 | int count; |
|
c4eea0409712
[gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15246
diff
changeset
|
144 | count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); |
| 15094 | 145 | refresh_scroll_box(scroll_book, page_num, count); |
| 146 | } | |
| 147 | ||
| 148 | static void | |
| 15577 | 149 | pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget) |
| 15094 | 150 | { |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
151 | PidginScrollBook *scroll_book; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
152 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
153 | g_return_if_fail(GTK_IS_WIDGET (widget)); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
154 | g_return_if_fail (widget->parent == NULL); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
155 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
156 | scroll_book = PIDGIN_SCROLL_BOOK(container); |
|
21719
b4d7c3fe216c
I'm pretty sure this is what was intended.
Daniel Atallah <datallah@pidgin.im>
parents:
21670
diff
changeset
|
157 | scroll_book->children = g_list_append(scroll_book->children, widget); |
| 15094 | 158 | gtk_widget_show(widget); |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
159 | gtk_notebook_append_page(GTK_NOTEBOOK(scroll_book->notebook), widget, NULL); |
| 15577 | 160 | page_count_change_cb(PIDGIN_SCROLL_BOOK(container)); |
| 15094 | 161 | } |
| 162 | ||
| 163 | static void | |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
164 | pidgin_scroll_book_remove(GtkContainer *container, GtkWidget *widget) |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
165 | { |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
166 | int page; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
167 | PidginScrollBook *scroll_book; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
168 | g_return_if_fail(GTK_IS_WIDGET(widget)); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
169 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
170 | scroll_book = PIDGIN_SCROLL_BOOK(container); |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
171 | scroll_book->children = g_list_remove(scroll_book->children, widget); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
172 | /* gtk_widget_unparent(widget); */ |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
173 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
174 | page = gtk_notebook_page_num(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
175 | if (page >= 0) { |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
176 | gtk_notebook_remove_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), page); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
177 | } |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
178 | } |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
179 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
180 | static void |
| 15577 | 181 | pidgin_scroll_book_forall(GtkContainer *container, |
| 15240 | 182 | gboolean include_internals, |
| 183 | GtkCallback callback, | |
| 184 | gpointer callback_data) | |
| 185 | { | |
|
21760
0f73c3c192ac
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 <datallah@pidgin.im>
parents:
21719
diff
changeset
|
186 | #if 0 |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
187 | GList *children; |
|
21760
0f73c3c192ac
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 <datallah@pidgin.im>
parents:
21719
diff
changeset
|
188 | #endif |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
189 | PidginScrollBook *scroll_book; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
190 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
191 | g_return_if_fail(GTK_IS_CONTAINER(container)); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
192 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
193 | scroll_book = PIDGIN_SCROLL_BOOK(container); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
194 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
195 | if (include_internals) { |
| 15240 | 196 | (*callback)(scroll_book->hbox, callback_data); |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
197 | (*callback)(scroll_book->notebook, callback_data); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
198 | } |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
199 | |
|
21760
0f73c3c192ac
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 <datallah@pidgin.im>
parents:
21719
diff
changeset
|
200 | #if 0 |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
201 | children = scroll_book->children; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
202 | |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
203 | while (children) { |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
204 | GtkWidget *child; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
205 | child = children->data; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
206 | children = children->next; |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
207 | (*callback)(child, callback_data); |
|
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
208 | } |
|
21760
0f73c3c192ac
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 <datallah@pidgin.im>
parents:
21719
diff
changeset
|
209 | #endif |
| 15240 | 210 | } |
| 211 | ||
| 212 | static void | |
| 15577 | 213 | pidgin_scroll_book_class_init (PidginScrollBookClass *klass) |
| 15094 | 214 | { |
| 215 | GtkContainerClass *container_class = (GtkContainerClass*)klass; | |
| 216 | ||
| 15577 | 217 | container_class->add = pidgin_scroll_book_add; |
|
21670
9ce6e7374523
This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
218 | container_class->remove = pidgin_scroll_book_remove; |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
219 | container_class->forall = pidgin_scroll_book_forall; |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
220 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
221 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
222 | static gboolean |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
223 | close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
224 | { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
225 | static GdkCursor *ptr = NULL; |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
226 | if (ptr == NULL) { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
227 | ptr = gdk_cursor_new(GDK_LEFT_PTR); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
228 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
229 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
230 | gtk_label_set_markup(label, "×"); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
231 | gdk_window_set_cursor(event->window, ptr); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
232 | return FALSE; |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
233 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
234 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
235 | static gboolean |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
236 | close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
237 | { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
238 | static GdkCursor *hand = NULL; |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
239 | if (hand == NULL) { |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
240 | hand = gdk_cursor_new(GDK_HAND2); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
241 | } |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
242 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
243 | gtk_label_set_markup(label, "<u>×</u>"); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
244 | gdk_window_set_cursor(event->window, hand); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
245 | return FALSE; |
| 15094 | 246 | } |
| 247 | ||
| 248 | static void | |
| 15577 | 249 | pidgin_scroll_book_init (PidginScrollBook *scroll_book) |
| 15094 | 250 | { |
| 251 | GtkWidget *eb; | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
252 | GtkWidget *close_button; |
| 15094 | 253 | |
| 254 | scroll_book->hbox = gtk_hbox_new(FALSE, 0); | |
| 255 | ||
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
256 | /* Close */ |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
257 | eb = gtk_event_box_new(); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
258 | gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
259 | gtk_event_box_set_visible_window(GTK_EVENT_BOX(eb), FALSE); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
260 | gtk_widget_set_events(eb, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
261 | close_button = gtk_label_new("×"); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
262 | g_signal_connect(G_OBJECT(eb), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_button); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
263 | g_signal_connect(G_OBJECT(eb), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_button); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
264 | gtk_container_add(GTK_CONTAINER(eb), close_button); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
265 | g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_close_cb), scroll_book); |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
266 | |
|
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
267 | /* Right arrow */ |
| 15094 | 268 | eb = gtk_event_box_new(); |
| 269 | gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0); | |
| 270 | scroll_book->right_arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE); | |
| 271 | gtk_container_add(GTK_CONTAINER(eb), scroll_book->right_arrow); | |
| 272 | g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_right_cb), scroll_book); | |
| 273 | ||
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
274 | /* Count */ |
| 15094 | 275 | scroll_book->label = gtk_label_new(NULL); |
| 276 | gtk_box_pack_end(GTK_BOX(scroll_book->hbox), scroll_book->label, FALSE, FALSE, 0); | |
| 277 | ||
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
278 | /* Left arrow */ |
| 15094 | 279 | eb = gtk_event_box_new(); |
| 280 | gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0); | |
| 281 | scroll_book->left_arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE); | |
| 282 | gtk_container_add(GTK_CONTAINER(eb), scroll_book->left_arrow); | |
| 283 | g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_left_cb), scroll_book); | |
| 284 | ||
| 285 | gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->hbox, FALSE, FALSE, 0); | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
286 | |
| 15094 | 287 | scroll_book->notebook = gtk_notebook_new(); |
| 288 | gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE); | |
| 289 | gtk_notebook_set_show_border(GTK_NOTEBOOK(scroll_book->notebook), FALSE); | |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
290 | |
| 15094 | 291 | gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->notebook, TRUE, TRUE, 0); |
|
21763
95ce28fc860a
Patch from DB42 to add a little '×' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21760
diff
changeset
|
292 | |
|
15190
4ce2829864f0
[gaim-migrate @ 17914]
Mark Doliner <markdoliner@pidgin.im>
parents:
15120
diff
changeset
|
293 | g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book); |
| 15094 | 294 | g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book); |
| 15243 | 295 | gtk_widget_show_all(scroll_book->notebook); |
| 15094 | 296 | } |
| 297 | ||
| 298 | GtkWidget * | |
| 15577 | 299 | pidgin_scroll_book_new() |
| 15094 | 300 | { |
| 15577 | 301 | return g_object_new(PIDGIN_TYPE_SCROLL_BOOK, NULL); |
| 15094 | 302 | } |