annotate plugins/ticker/gtkticker.c @ 7808:4707d8436806

[gaim-migrate @ 8455] Yeah. Thanks to David Atallah for the disconnect dialog patch. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 08 Dec 2003 06:47:58 +0000
parents aeb5ee62debc
children e856f985a0b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /* GTK - The GIMP Toolkit
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * modify it under the terms of the GNU Library General Public
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * Library General Public License for more details.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 *
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * You should have received a copy of the GNU Library General Public
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * License along with this library; if not, write to the
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * Boston, MA 02111-1307, USA.
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 */
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 /*
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * GtkTicker Copyright 2000 Syd Logan
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 */
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "gtkticker.h"
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include <gtk/gtk.h>
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 static void gtk_ticker_compute_offsets (GtkTicker *ticker);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 static void gtk_ticker_class_init (GtkTickerClass *klass);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 static void gtk_ticker_init (GtkTicker *ticker);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 static void gtk_ticker_map (GtkWidget *widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 static void gtk_ticker_realize (GtkWidget *widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 static void gtk_ticker_size_request (GtkWidget *widget,
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
33 GtkRequisition *requisition);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 static void gtk_ticker_size_allocate (GtkWidget *widget,
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
35 GtkAllocation *allocation);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 static void gtk_ticker_add_real (GtkContainer *container,
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
37 GtkWidget *widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 static void gtk_ticker_remove_real (GtkContainer *container,
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
39 GtkWidget *widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 static void gtk_ticker_forall (GtkContainer *container,
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
41 gboolean include_internals,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
42 GtkCallback callback,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
43 gpointer callback_data);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 static GtkType gtk_ticker_child_type (GtkContainer *container);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 static GtkContainerClass *parent_class = NULL;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
50 GType gtk_ticker_get_type (void)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
52 static GType ticker_type = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
6560
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
54 ticker_type = g_type_from_name("GtkTicker");
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
55
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
56 if (!ticker_type)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
57 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
58 static const GTypeInfo ticker_info =
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
59 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
60 sizeof(GtkTickerClass),
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
61 NULL,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
62 NULL,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
63 (GClassInitFunc) gtk_ticker_class_init,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
64 NULL,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
65 NULL,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
66 sizeof(GtkTicker),
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
67 0,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
68 (GInstanceInitFunc) gtk_ticker_init
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
69 };
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
71 ticker_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkTicker",
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
72 &ticker_info, 0);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
73 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
6560
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
75 /* kludge to re-initialise the class if it's already registered */
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
76 else if (parent_class == NULL) {
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
77 gtk_ticker_class_init((GtkTickerClass *)g_type_class_peek(ticker_type));
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
78 }
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
79
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
80 return ticker_type;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
81 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
82
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
83 static void gtk_ticker_finalize(GObject *object) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
84 gtk_ticker_stop_scroll(GTK_TICKER(object));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
85
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
86 G_OBJECT_CLASS(parent_class)->finalize(object);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
89 static void gtk_ticker_class_init (GtkTickerClass *class)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
91 GObjectClass *gobject_class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
92 GtkWidgetClass *widget_class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
93 GtkContainerClass *container_class;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
95 gobject_class = (GObjectClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
96 widget_class = (GtkWidgetClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
97 container_class = (GtkContainerClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
98
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
99 parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
101 gobject_class->finalize = gtk_ticker_finalize;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
103 widget_class->map = gtk_ticker_map;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
104 widget_class->realize = gtk_ticker_realize;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
105 widget_class->size_request = gtk_ticker_size_request;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
106 widget_class->size_allocate = gtk_ticker_size_allocate;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
108 container_class->add = gtk_ticker_add_real;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
109 container_class->remove = gtk_ticker_remove_real;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
110 container_class->forall = gtk_ticker_forall;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
111 container_class->child_type = gtk_ticker_child_type;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
114 static GtkType gtk_ticker_child_type (GtkContainer *container)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
116 return GTK_TYPE_WIDGET;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
119 static void gtk_ticker_init (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
121 GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
123 ticker->interval = (guint) 200;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
124 ticker->scootch = (guint) 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
125 ticker->children = NULL;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
126 ticker->timer = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
127 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
130 GtkWidget* gtk_ticker_new (void)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
132 return GTK_WIDGET(g_object_new(GTK_TYPE_TICKER, NULL));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
135 static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
137 GtkTickerChild *child_info;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
139 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
140 g_return_if_fail (GTK_IS_TICKER (ticker));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
141 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
143 child_info = g_new(GtkTickerChild, 1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
144 child_info->widget = widget;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
145 child_info->x = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
147 gtk_widget_set_parent(widget, GTK_WIDGET (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
149 ticker->children = g_list_append (ticker->children, child_info);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
151 if (GTK_WIDGET_REALIZED (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
152 gtk_widget_realize (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
154 if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
155 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
156 if (GTK_WIDGET_MAPPED (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
157 gtk_widget_map (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
158
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
159 gtk_widget_queue_resize (GTK_WIDGET (ticker));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
160 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
163 void gtk_ticker_set_interval (GtkTicker *ticker, gint interval)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
165 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
166 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
168 if ( interval < 0 )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
169 interval = 200;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
170 ticker->interval = interval;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
173 guint gtk_ticker_get_interval (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
175 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
176 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
178 return ticker->interval;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
181 void gtk_ticker_set_scootch (GtkTicker *ticker, gint scootch)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
183 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
184 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
186 if (scootch <= 0)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
187 scootch = 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
188 ticker->scootch = scootch;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
189 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
192 guint gtk_ticker_get_scootch (GtkTicker *ticker )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
194 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
195 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
197 return ticker->scootch;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
200 void gtk_ticker_set_spacing (GtkTicker *ticker, gint spacing )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
202 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
203 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
205 if ( spacing < 0 )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
206 spacing = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
207 ticker->spacing = spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
208 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
211 static int ticker_timeout(gpointer data)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 GtkTicker *ticker = (GtkTicker *) data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
215 if (GTK_WIDGET_VISIBLE (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
216 gtk_widget_queue_resize (GTK_WIDGET (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 return( TRUE );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
221 void gtk_ticker_start_scroll(GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
223 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
224 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 if ( ticker->timer != 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
227 ticker->timer = g_timeout_add(ticker->interval, ticker_timeout, ticker);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
230 void gtk_ticker_stop_scroll(GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
232 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
233 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 if ( ticker->timer == 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
236 g_source_remove(ticker->timer);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 ticker->timer = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
240 guint gtk_ticker_get_spacing (GtkTicker *ticker )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
242 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
243 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
245 return ticker->spacing;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
248 static void gtk_ticker_map (GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
250 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
251 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
252 GList *children;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
254 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
255 g_return_if_fail (GTK_IS_TICKER (widget));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
257 GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
258 ticker = GTK_TICKER (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
260 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
261 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
262 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
263 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
264 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
266 if (GTK_WIDGET_VISIBLE (child->widget) &&
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
267 !GTK_WIDGET_MAPPED (child->widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
268 gtk_widget_map (child->widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
269 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
271 gdk_window_show (widget->window);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
274 static void gtk_ticker_realize (GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
276 GdkWindowAttr attributes;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
277 gint attributes_mask;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
279 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
280 g_return_if_fail (GTK_IS_TICKER (widget));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
282 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
284 attributes.window_type = GDK_WINDOW_CHILD;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
285 attributes.x = widget->allocation.x;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
286 attributes.y = widget->allocation.y;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
287 attributes.width = widget->allocation.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
288 attributes.height = widget->allocation.height;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
289 attributes.wclass = GDK_INPUT_OUTPUT;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
290 attributes.visual = gtk_widget_get_visual (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
291 attributes.colormap = gtk_widget_get_colormap (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
292 attributes.event_mask = gtk_widget_get_events (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
293 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
295 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
297 widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
298 &attributes, attributes_mask);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
299 gdk_window_set_user_data (widget->window, widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
301 widget->style = gtk_style_attach (widget->style, widget->window);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
302 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
305 static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
307 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
308 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
309 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
310 GtkRequisition child_requisition;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
312 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
313 g_return_if_fail (GTK_IS_TICKER (widget));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
314 g_return_if_fail (requisition != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
316 ticker = GTK_TICKER (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
317 requisition->width = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
318 requisition->height = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
320 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
321 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
322 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
323 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
324 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
326 if (GTK_WIDGET_VISIBLE (child->widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
327 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
328 gtk_widget_size_request (child->widget, &child_requisition);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
330 requisition->height = MAX (requisition->height,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
331 child_requisition.height);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
332 requisition->width += child_requisition.width + ticker->spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
333 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
335 if ( requisition->width > ticker->spacing )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
336 requisition->width -= ticker->spacing;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
338 requisition->height += GTK_CONTAINER (ticker)->border_width * 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
339 requisition->width += GTK_CONTAINER (ticker)->border_width * 2;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
342 static void gtk_ticker_compute_offsets (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
344 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
345 GtkRequisition child_requisition;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
346 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
347 guint16 border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
349 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
350 g_return_if_fail (GTK_IS_TICKER(ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
352 border_width = GTK_CONTAINER (ticker)->border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
354 ticker->width = GTK_WIDGET(ticker)->allocation.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
355 ticker->total = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
356 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
357 while (children) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
358 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
359
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
360 child->x = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
361 if (GTK_WIDGET_VISIBLE (child->widget)) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
362 gtk_widget_get_child_requisition (child->widget, &child_requisition);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
363 child->offset = ticker->total;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
364 ticker->total +=
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
365 child_requisition.width + border_width + ticker->spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
366 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
367 children = children->next;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
368 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
369 ticker->dirty = FALSE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
372 static void gtk_ticker_size_allocate (GtkWidget *widget,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
373 GtkAllocation *allocation)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
375 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
376 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
377 GtkAllocation child_allocation;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
378 GtkRequisition child_requisition;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
379 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
380 guint16 border_width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
381
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
382 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
383 g_return_if_fail (GTK_IS_TICKER(widget));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
384 g_return_if_fail (allocation != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
385
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
386 ticker = GTK_TICKER (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
388 if ( GTK_WIDGET(ticker)->allocation.width != ticker->width )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
389 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
391 if ( ticker->dirty == TRUE ) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
392 gtk_ticker_compute_offsets( ticker );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
393 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
395 widget->allocation = *allocation;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
396 if (GTK_WIDGET_REALIZED (widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
397 gdk_window_move_resize (widget->window,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
398 allocation->x,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
399 allocation->y,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
400 allocation->width,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
401 allocation->height);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
403 border_width = GTK_CONTAINER (ticker)->border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
405 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
406 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
407 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
408 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
409 child->x -= ticker->scootch;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
411 if (GTK_WIDGET_VISIBLE (child->widget)) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
412 gtk_widget_get_child_requisition (child->widget, &child_requisition);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
413 child_allocation.width = child_requisition.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
414 child_allocation.x = child->offset + border_width + child->x;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
415 if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
416 if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
417 child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
418 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
419 else {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
420 child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
421 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
422 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
423 child_allocation.y = border_width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
424 child_allocation.height = child_requisition.height;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
425 gtk_widget_size_allocate (child->widget, &child_allocation);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
427 children = children->next;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
428 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
429 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
430
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
431 void gtk_ticker_add(GtkTicker *ticker, GtkWidget *widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
432 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
433 gtk_ticker_add_real( GTK_CONTAINER( ticker ), widget );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
434 ticker->dirty = TRUE;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
435 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
436
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
437 void gtk_ticker_remove(GtkTicker *ticker, GtkWidget *widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
438 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
439 gtk_ticker_remove_real( GTK_CONTAINER( ticker ), widget );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
440 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
443 static void gtk_ticker_add_real(GtkContainer *container, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
445 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
446 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
447 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
449 gtk_ticker_put(GTK_TICKER (container), widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
452 static void gtk_ticker_remove_real(GtkContainer *container, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
454 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
455 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
456 GList *children;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
458 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
459 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
460 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
462 ticker = GTK_TICKER (container);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
464 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
465 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
466 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
467 child = children->data;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
469 if (child->widget == widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
470 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
471 gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
472
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
473 gtk_widget_unparent (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
475 ticker->children = g_list_remove_link (ticker->children, children);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
476 g_list_free (children);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
477 g_free (child);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
479 if (was_visible && GTK_WIDGET_VISIBLE (container))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
480 gtk_widget_queue_resize (GTK_WIDGET (container));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
482 break;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
483 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
485 children = children->next;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
486 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
489 static void gtk_ticker_forall (GtkContainer *container,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
490 gboolean include_internals,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
491 GtkCallback callback,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
492 gpointer callback_data)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
494 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
495 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
496 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
497
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
498 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
499 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
500 g_return_if_fail (callback != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
502 ticker = GTK_TICKER (container);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
504 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
505 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
506 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
507 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
508 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
510 (* callback) (child->widget, callback_data);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
511 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
513