pidgin/pidginscrollbook.c

Thu, 02 Sep 2021 20:18:36 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 02 Sep 2021 20:18:36 -0500
changeset 41036
c2a9da21b8c0
parent 40893
0131c0786803
permissions
-rw-r--r--

Replace the deprecated API in gtkaccount.c

Testing Done:
Verified that all of the dialog buttons still function as intended.

Reviewed at https://reviews.imfreedom.org/r/906/

40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
1 /*
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
2 * Pidgin - Internet Messenger
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * source distribution.
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 *
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * (at your option) any later version.
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 *
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * GNU General Public License for more details.
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 *
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 */
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
23 #include "pidginscrollbook.h"
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
25 struct _PidginScrollBook {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
26 GtkVBox parent;
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
27
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
28 GtkWidget *notebook;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
29 GtkWidget *hbox;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
30 GtkWidget *label;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
31 GtkWidget *left_arrow;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
32 GtkWidget *right_arrow;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
33 GList *children;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
34 };
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
35
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
36 G_DEFINE_TYPE(PidginScrollBook, pidgin_scroll_book, GTK_TYPE_BOX)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
37
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
38 /******************************************************************************
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
39 * Helpers
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
40 *****************************************************************************/
22032
8136dd5eeda3 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21763
diff changeset
41 static gboolean
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
42 scroll_left_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
43 {
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
44 int index;
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
45
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
46 if (event->type != GDK_BUTTON_PRESS)
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
47 return FALSE;
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
48
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
49 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
50
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
51 if (index > 0)
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
52 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
53 return TRUE;
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
55
22032
8136dd5eeda3 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21763
diff changeset
56 static gboolean
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
57 scroll_right_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
58 {
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
59 int index, count;
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
60
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
61 if (event->type != GDK_BUTTON_PRESS)
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
62 return FALSE;
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
63
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
64 index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
65 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
66
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
67 if (index + 1 < count)
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
68 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
69 return TRUE;
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
70 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
71
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
72 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
73 refresh_scroll_box(PidginScrollBook *scroll_book, int index, int count)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
74 {
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
75 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
76
15114
4224e5db3ee4 [gaim-migrate @ 17836]
Mark Doliner <markdoliner@pidgin.im>
parents: 15094
diff changeset
77 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
78 if (count < 1)
33133
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
79 gtk_widget_hide(scroll_book->hbox);
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
80 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
81 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
82 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
83 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
84 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
85 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
86 }
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
87 }
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
88
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
89 label = g_strdup_printf("<span size='smaller' weight='bold'>(%d/%d)</span>", index+1, count);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
90 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
91 g_free(label);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
92
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
93 if (index == 0)
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
94 gtk_widget_set_sensitive(scroll_book->left_arrow, FALSE);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
95 else
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
96 gtk_widget_set_sensitive(scroll_book->left_arrow, TRUE);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
97
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
98
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 if (index + 1 == count)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
100 gtk_widget_set_sensitive(scroll_book->right_arrow, FALSE);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
101 else
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
102 gtk_widget_set_sensitive(scroll_book->right_arrow, TRUE);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
103 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
104
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
107 page_count_change_cb(PidginScrollBook *scroll_book)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
108 {
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15240
diff changeset
109 int count;
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110 int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15240
diff changeset
111 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112 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
113 }
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
114
22032
8136dd5eeda3 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21763
diff changeset
115 static gboolean
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
116 scroll_close_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
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
117 {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31179
diff changeset
118 if (event->type == GDK_BUTTON_PRESS)
31179
245a26364487 The left/right scroll, and close buttons in a PidginScrollBook should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29499
diff changeset
119 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
120 return FALSE;
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
121 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
122
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
123 static void
32915
27891bd13ca3 It appears that GtkNotebookPage is deprecated, though the 'switch-page'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
124 switch_page_cb(GtkNotebook *notebook, GtkWidget *page, guint page_num, PidginScrollBook *scroll_book)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
125 {
15320
c4eea0409712 [gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15246
diff changeset
126 int count;
c4eea0409712 [gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15246
diff changeset
127 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
128 refresh_scroll_box(scroll_book, page_num, count);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
131 static gboolean
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
132 close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
133 {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
134 static GdkCursor *ptr = NULL;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
135 if (ptr == NULL) {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
136 GdkDisplay *display = gtk_widget_get_display(widget);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
137 ptr = gdk_cursor_new_for_display(display, GDK_LEFT_PTR);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
138 }
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
139
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
140 gtk_label_set_markup(label, "×");
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
141 gdk_window_set_cursor(event->window, ptr);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
142 return FALSE;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
143 }
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
144
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
145 static gboolean
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
146 close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label)
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
147 {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
148 static GdkCursor *hand = NULL;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
149 if (hand == NULL) {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
150 GdkDisplay *display = gtk_widget_get_display(widget);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
151 hand = gdk_cursor_new_for_display(display, GDK_HAND2);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
152 }
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
153
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
154 gtk_label_set_markup(label, "<u>×</u>");
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
155 gdk_window_set_cursor(event->window, hand);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
156 return FALSE;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
157 }
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
158
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
159 /******************************************************************************
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
160 * GtkContainer Implementation
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
161 *****************************************************************************/
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
163 pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
164 {
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
165 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
166
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
167 g_return_if_fail(GTK_IS_WIDGET (widget));
33133
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
168 g_return_if_fail(gtk_widget_get_parent(widget) == NULL);
21670
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);
21719
b4d7c3fe216c I'm pretty sure this is what was intended.
Daniel Atallah <datallah@pidgin.im>
parents: 21670
diff changeset
171 scroll_book->children = g_list_append(scroll_book->children, widget);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
172 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
173 gtk_notebook_append_page(GTK_NOTEBOOK(scroll_book->notebook), widget, NULL);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
174 page_count_change_cb(PIDGIN_SCROLL_BOOK(container));
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
175 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 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
178 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
179 {
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
180 int page;
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
181 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
182 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
183
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
184 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
185 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
186 /* 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
187
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
188 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
189 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
190 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
191 }
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
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
194 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
195 pidgin_scroll_book_forall(GtkContainer *container,
15240
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
196 gboolean include_internals,
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
197 GtkCallback callback,
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
198 gpointer callback_data)
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
199 {
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
200 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
201
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
202 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
203
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
204 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
205
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20147
diff changeset
206 if (include_internals) {
15240
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
207 (*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
208 (*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
209 }
15240
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
210 }
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
211
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
212 /******************************************************************************
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
213 * GObject Implementation
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
214 *****************************************************************************/
15240
3aa0e80143e8 [gaim-migrate @ 17965]
Sean Egan <seanegan@pidgin.im>
parents: 15190
diff changeset
215 static void
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
216 pidgin_scroll_book_class_init(PidginScrollBookClass *klass) {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
217 GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
219 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
220 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
221 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
222 }
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
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 static void
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
225 pidgin_scroll_book_init(PidginScrollBook *scroll_book) {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
226 GIcon *icon;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
227 GtkWidget *eb;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
228 GtkWidget *close_button;
39842
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
229 const gchar *left_arrow_icon_names[] = {
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
230 "pan-start-symbolic",
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
231 "pan-left-symbolic",
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
232 };
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
233 const gchar *right_arrow_icon_names[] = {
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
234 "pan-end-symbolic",
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
235 "pan-right-symbolic",
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
236 };
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
237
37994
11829debec7a Replace Gtk[HV]Box with GtkBox.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35531
diff changeset
238 gtk_orientable_set_orientation(GTK_ORIENTABLE(scroll_book), GTK_ORIENTATION_VERTICAL);
11829debec7a Replace Gtk[HV]Box with GtkBox.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35531
diff changeset
239
35528
e04ba70092e9 Fix the rest of [hv] gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35454
diff changeset
240 scroll_book->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
241
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
242 /* 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
243 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
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251 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
252
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
253 /* Right arrow */
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
254 eb = gtk_event_box_new();
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
255 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
39858
0f2be88d88e4 Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39842
diff changeset
256 icon = g_themed_icon_new_from_names((char **)right_arrow_icon_names,
0f2be88d88e4 Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39842
diff changeset
257 G_N_ELEMENTS(right_arrow_icon_names));
39842
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
258 scroll_book->right_arrow =
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
259 gtk_image_new_from_gicon(icon, GTK_ICON_SIZE_BUTTON);
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
260 g_object_unref(icon);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
261 gtk_container_add(GTK_CONTAINER(eb), scroll_book->right_arrow);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_right_cb), scroll_book);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263
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
264 /* Count */
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
265 scroll_book->label = gtk_label_new(NULL);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
266 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), scroll_book->label, FALSE, FALSE, 0);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267
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
268 /* Left arrow */
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
269 eb = gtk_event_box_new();
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
270 gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0);
39858
0f2be88d88e4 Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39842
diff changeset
271 icon = g_themed_icon_new_from_names((char **)left_arrow_icon_names,
0f2be88d88e4 Fix some minor warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39842
diff changeset
272 G_N_ELEMENTS(left_arrow_icon_names));
39842
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
273 scroll_book->left_arrow =
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
274 gtk_image_new_from_gicon(icon, GTK_ICON_SIZE_BUTTON);
66da823fe9b3 Fix left/right arrows in scrollbook.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
275 g_object_unref(icon);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
276 gtk_container_add(GTK_CONTAINER(eb), scroll_book->left_arrow);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
277 g_signal_connect_swapped(G_OBJECT(eb), "button-press-event", G_CALLBACK(scroll_left_cb), scroll_book);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
278
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
279 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
280
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
281 scroll_book->notebook = gtk_notebook_new();
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
282 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE);
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
283 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
284
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
285 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
286
15190
4ce2829864f0 [gaim-migrate @ 17914]
Mark Doliner <markdoliner@pidgin.im>
parents: 15120
diff changeset
287 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
288 g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book);
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15240
diff changeset
289 gtk_widget_show_all(scroll_book->notebook);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
290 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
291
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
292 /******************************************************************************
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
293 * Public API
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
294 *****************************************************************************/
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295 GtkWidget *
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
296 pidgin_scroll_book_new() {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
297 return g_object_new(
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
298 PIDGIN_TYPE_SCROLL_BOOK,
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
299 "orientation", GTK_ORIENTATION_VERTICAL,
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
300 NULL);
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
301 }
40893
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
302
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
303 GtkWidget *
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
304 pidgin_scroll_book_get_notebook(PidginScrollBook *scroll_book) {
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
305 g_return_val_if_fail(PIDGIN_IS_SCROLL_BOOK(scroll_book), NULL);
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
306
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
307 return scroll_book->notebook;
0131c0786803 Clean up the scroll book widget a bit
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
308 }

mercurial