annotate plugins/ticker/gtkticker.c @ 4777:e23a7e166680

[gaim-migrate @ 5097] - a couple compile cleanups - status messages and tooltips won't crash gaim when people put up certain away messages - yahoo status messages will show the current "custom" message instead of the previous one committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 14 Mar 2003 22:49:32 +0000
parents 42d53c416bb9
children 13ffa9ae4282
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,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 GtkRequisition *requisition);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 static void gtk_ticker_size_allocate (GtkWidget *widget,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 GtkAllocation *allocation);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 static gint gtk_ticker_expose (GtkWidget *widget,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 GdkEventExpose *event);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 static void gtk_ticker_add_real (GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 GtkWidget *widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 static void gtk_ticker_remove_real (GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 GtkWidget *widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 static void gtk_ticker_forall (GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 gboolean include_internals,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 GtkCallback callback,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 gpointer callback_data);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 static GtkType gtk_ticker_child_type (GtkContainer *container);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
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 static GtkContainerClass *parent_class = NULL;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
52 GType
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 gtk_ticker_get_type (void)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
55 static GType ticker_type = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 if (!ticker_type)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
59 static const GTypeInfo ticker_info =
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
61 sizeof(GtkTickerClass),
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
62 NULL,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
63 NULL,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
64 (GClassInitFunc) gtk_ticker_class_init,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
65 NULL,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
66 NULL,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
67 sizeof(GtkTicker),
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
68 0,
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
69 (GInstanceInitFunc) gtk_ticker_init
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 };
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
72 ticker_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkTicker",
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
73 &ticker_info, 0);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 return ticker_type;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 gtk_ticker_class_init (GtkTickerClass *class)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 GtkObjectClass *object_class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 GtkWidgetClass *widget_class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 GtkContainerClass *container_class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 object_class = (GtkObjectClass*) class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 widget_class = (GtkWidgetClass*) class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 container_class = (GtkContainerClass*) class;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 widget_class->map = gtk_ticker_map;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 widget_class->realize = gtk_ticker_realize;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 widget_class->size_request = gtk_ticker_size_request;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 widget_class->size_allocate = gtk_ticker_size_allocate;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 widget_class->expose_event = gtk_ticker_expose;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 container_class->add = gtk_ticker_add_real;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 container_class->remove = gtk_ticker_remove_real;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 container_class->forall = gtk_ticker_forall;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 container_class->child_type = gtk_ticker_child_type;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 static GtkType
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 gtk_ticker_child_type (GtkContainer *container)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 return GTK_TYPE_WIDGET;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 gtk_ticker_init (GtkTicker *ticker)
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 GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 ticker->interval = (guint) 200;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 ticker->scootch = (guint) 2;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 ticker->children = NULL;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 ticker->timer = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 GtkWidget*
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 gtk_ticker_new (void)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
125 return GTK_WIDGET(g_object_new(GTK_TYPE_TICKER, NULL));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 gtk_ticker_put (GtkTicker *ticker,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 GtkTickerChild *child_info;
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 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 child_info = g_new(GtkTickerChild, 1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 child_info->widget = widget;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 child_info->x = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 gtk_widget_set_parent(widget, GTK_WIDGET (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 ticker->children = g_list_append (ticker->children, child_info);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 if (GTK_WIDGET_REALIZED (ticker))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 gtk_widget_realize (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 if (GTK_WIDGET_MAPPED (ticker))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 gtk_widget_map (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 gtk_widget_queue_resize (GTK_WIDGET (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 gtk_ticker_set_interval (GtkTicker *ticker, gint interval )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 if ( interval < 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 interval = 200;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 ticker->interval = interval;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 guint
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 gtk_ticker_get_interval (GtkTicker *ticker )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 g_return_val_if_fail (ticker != NULL, -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 return ticker->interval;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 gtk_ticker_set_scootch (GtkTicker *ticker, gint scootch )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 if ( scootch <= 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 scootch = 2;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 ticker->scootch = scootch;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
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 guint
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 gtk_ticker_get_scootch (GtkTicker *ticker )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 g_return_val_if_fail (ticker != NULL, -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 return ticker->scootch;
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
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 gtk_ticker_set_spacing (GtkTicker *ticker, gint spacing )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 if ( spacing < 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 spacing = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 ticker->spacing = spacing;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 }
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 static int
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 ticker_timeout( gpointer data )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 GtkTicker *ticker = (GtkTicker *) data;
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 if (GTK_WIDGET_VISIBLE (ticker))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 gtk_widget_queue_resize (GTK_WIDGET (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 return( TRUE );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 gtk_ticker_start_scroll(GtkTicker *ticker)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 if ( ticker->timer != 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
231 ticker->timer = g_timeout_add(ticker->interval, ticker_timeout, ticker);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 gtk_ticker_stop_scroll(GtkTicker *ticker)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 g_return_if_fail (GTK_IS_TICKER (ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 if ( ticker->timer == 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
241 g_source_remove(ticker->timer);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 ticker->timer = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 guint
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 gtk_ticker_get_spacing (GtkTicker *ticker )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 g_return_val_if_fail (ticker != NULL, -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 return ticker->spacing;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 gtk_ticker_map (GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 g_return_if_fail (GTK_IS_TICKER (widget));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 ticker = GTK_TICKER (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 if (GTK_WIDGET_VISIBLE (child->widget) &&
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 !GTK_WIDGET_MAPPED (child->widget))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 gtk_widget_map (child->widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 gdk_window_show (widget->window);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 gtk_ticker_realize (GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 GdkWindowAttr attributes;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 gint attributes_mask;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 g_return_if_fail (GTK_IS_TICKER (widget));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 attributes.window_type = GDK_WINDOW_CHILD;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 attributes.x = widget->allocation.x;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 attributes.y = widget->allocation.y;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 attributes.width = widget->allocation.width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 attributes.height = widget->allocation.height;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 attributes.wclass = GDK_INPUT_OUTPUT;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 attributes.visual = gtk_widget_get_visual (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 attributes.colormap = gtk_widget_get_colormap (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 attributes.event_mask = gtk_widget_get_events (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
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 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 &attributes, attributes_mask);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 gdk_window_set_user_data (widget->window, widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 widget->style = gtk_style_attach (widget->style, widget->window);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 gtk_ticker_size_request (GtkWidget *widget,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 GtkRequisition *requisition)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 GtkRequisition child_requisition;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 g_return_if_fail (GTK_IS_TICKER (widget));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 g_return_if_fail (requisition != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 ticker = GTK_TICKER (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 requisition->width = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 requisition->height = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 if (GTK_WIDGET_VISIBLE (child->widget))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 gtk_widget_size_request (child->widget, &child_requisition);
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 requisition->height = MAX (requisition->height,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 child_requisition.height);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 requisition->width += child_requisition.width + ticker->spacing;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 if ( requisition->width > ticker->spacing )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 requisition->width -= ticker->spacing;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 requisition->height += GTK_CONTAINER (ticker)->border_width * 2;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 requisition->width += GTK_CONTAINER (ticker)->border_width * 2;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 gtk_ticker_compute_offsets (GtkTicker *ticker)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 GtkRequisition child_requisition;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 guint16 border_width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 g_return_if_fail (ticker != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 g_return_if_fail (GTK_IS_TICKER(ticker));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 border_width = GTK_CONTAINER (ticker)->border_width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 ticker->width = GTK_WIDGET(ticker)->allocation.width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 ticker->total = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 while (children) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 child->x = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 if (GTK_WIDGET_VISIBLE (child->widget)) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 gtk_widget_get_child_requisition (child->widget, &child_requisition);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 child->offset = ticker->total;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 ticker->total +=
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 child_requisition.width + border_width + ticker->spacing;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 ticker->dirty = FALSE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 gtk_ticker_size_allocate (GtkWidget *widget,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 GtkAllocation *allocation)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 GtkAllocation child_allocation;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 GtkRequisition child_requisition;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 guint16 border_width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 g_return_if_fail (GTK_IS_TICKER(widget));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 g_return_if_fail (allocation != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 ticker = GTK_TICKER (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 if ( GTK_WIDGET(ticker)->allocation.width != ticker->width )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 if ( ticker->dirty == TRUE ) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 gtk_ticker_compute_offsets( ticker );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 widget->allocation = *allocation;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 if (GTK_WIDGET_REALIZED (widget))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 gdk_window_move_resize (widget->window,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 allocation->x,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 allocation->y,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 allocation->width,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 allocation->height);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 border_width = GTK_CONTAINER (ticker)->border_width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 child->x -= ticker->scootch;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 if (GTK_WIDGET_VISIBLE (child->widget)) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 gtk_widget_get_child_requisition (child->widget, &child_requisition);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 child_allocation.width = child_requisition.width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 child_allocation.x = child->offset + border_width + child->x;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 else {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 child_allocation.y = border_width;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 child_allocation.height = child_requisition.height;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 gtk_widget_size_allocate (child->widget, &child_allocation);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 children = children->next;
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 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 static gint
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 gtk_ticker_expose (GtkWidget *widget, GdkEventExpose *event)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 GdkEventExpose child_event;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 g_return_val_if_fail (widget != NULL, FALSE);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 g_return_val_if_fail (GTK_IS_TICKER (widget), FALSE);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 g_return_val_if_fail (event != NULL, FALSE);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 if (GTK_WIDGET_DRAWABLE (widget))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 ticker = GTK_TICKER (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 child_event = *event;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 if (GTK_WIDGET_NO_WINDOW (child->widget) &&
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 gtk_widget_intersect (child->widget, &event->area,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 &child_event.area))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 gtk_widget_event (child->widget, (GdkEvent*) &child_event);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 return FALSE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3391
diff changeset
478
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 gtk_ticker_add(GtkTicker *ticker, GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 gtk_ticker_add_real( GTK_CONTAINER( ticker ), widget );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 gtk_ticker_remove(GtkTicker *ticker, GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 gtk_ticker_remove_real( GTK_CONTAINER( ticker ), widget );
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 ticker->dirty = TRUE;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 gtk_ticker_add_real(GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 g_return_if_fail (container != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 g_return_if_fail (GTK_IS_TICKER (container));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 gtk_ticker_put(GTK_TICKER (container), widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 gtk_ticker_remove_real(GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 GtkWidget *widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 g_return_if_fail (container != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 g_return_if_fail (GTK_IS_TICKER (container));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 g_return_if_fail (widget != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 ticker = GTK_TICKER (container);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 if (child->widget == widget)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 gtk_widget_unparent (widget);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 ticker->children = g_list_remove_link (ticker->children, children);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 g_list_free (children);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 g_free (child);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 if (was_visible && GTK_WIDGET_VISIBLE (container))
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 gtk_widget_queue_resize (GTK_WIDGET (container));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 break;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 static void
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 gtk_ticker_forall (GtkContainer *container,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 gboolean include_internals,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 GtkCallback callback,
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 gpointer callback_data)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 GtkTicker *ticker;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 GtkTickerChild *child;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 GList *children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 g_return_if_fail (container != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 g_return_if_fail (GTK_IS_TICKER (container));
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 g_return_if_fail (callback != NULL);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 ticker = GTK_TICKER (container);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 children = ticker->children;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 while (children)
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 child = children->data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 children = children->next;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 (* callback) (child->widget, callback_data);
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 }