annotate plugins/ticker/gtkticker.c @ 19754:da3f8f7ec3ce

[gaim-migrate @ 16737] can send Message to Yahoo Messenger can receive the Yahoo Message, Need to post it to the conversation committed by Ma Yuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sun, 13 Aug 2006 16:01:52 +0000
parents e856f985a0b9
children
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,
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 6560
diff changeset
68 (GInstanceInitFunc) gtk_ticker_init,
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 6560
diff changeset
69 NULL
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
70 };
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
72 ticker_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkTicker",
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
73 &ticker_info, 0);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
74 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
6560
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
76 /* kludge to re-initialise the class if it's already registered */
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
77 else if (parent_class == NULL) {
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
78 gtk_ticker_class_init((GtkTickerClass *)g_type_class_peek(ticker_type));
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
79 }
aeb5ee62debc [gaim-migrate @ 7082]
Luke Schierer <lschiere@pidgin.im>
parents: 5170
diff changeset
80
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
81 return ticker_type;
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
84 static void gtk_ticker_finalize(GObject *object) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
85 gtk_ticker_stop_scroll(GTK_TICKER(object));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
86
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
87 G_OBJECT_CLASS(parent_class)->finalize(object);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
90 static void gtk_ticker_class_init (GtkTickerClass *class)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
92 GObjectClass *gobject_class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
93 GtkWidgetClass *widget_class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
94 GtkContainerClass *container_class;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
96 gobject_class = (GObjectClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
97 widget_class = (GtkWidgetClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
98 container_class = (GtkContainerClass*) class;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
99
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
100 parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
102 gobject_class->finalize = gtk_ticker_finalize;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
104 widget_class->map = gtk_ticker_map;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
105 widget_class->realize = gtk_ticker_realize;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
106 widget_class->size_request = gtk_ticker_size_request;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
107 widget_class->size_allocate = gtk_ticker_size_allocate;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
109 container_class->add = gtk_ticker_add_real;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
110 container_class->remove = gtk_ticker_remove_real;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
111 container_class->forall = gtk_ticker_forall;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
112 container_class->child_type = gtk_ticker_child_type;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
115 static GtkType gtk_ticker_child_type (GtkContainer *container)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
117 return GTK_TYPE_WIDGET;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
120 static void gtk_ticker_init (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
122 GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
124 ticker->interval = (guint) 200;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
125 ticker->scootch = (guint) 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
126 ticker->children = NULL;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
127 ticker->timer = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
128 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
131 GtkWidget* gtk_ticker_new (void)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 {
4635
42d53c416bb9 [gaim-migrate @ 4942]
Nathan Walp <nwalp@pidgin.im>
parents: 4168
diff changeset
133 return GTK_WIDGET(g_object_new(GTK_TYPE_TICKER, NULL));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
136 static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
138 GtkTickerChild *child_info;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
140 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
141 g_return_if_fail (GTK_IS_TICKER (ticker));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
142 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
144 child_info = g_new(GtkTickerChild, 1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
145 child_info->widget = widget;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
146 child_info->x = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
148 gtk_widget_set_parent(widget, GTK_WIDGET (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
150 ticker->children = g_list_append (ticker->children, child_info);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
152 if (GTK_WIDGET_REALIZED (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
153 gtk_widget_realize (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
155 if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
156 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
157 if (GTK_WIDGET_MAPPED (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
158 gtk_widget_map (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
159
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
160 gtk_widget_queue_resize (GTK_WIDGET (ticker));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
161 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
164 void gtk_ticker_set_interval (GtkTicker *ticker, gint interval)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
166 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
167 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
169 if ( interval < 0 )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
170 interval = 200;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
171 ticker->interval = interval;
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
174 guint gtk_ticker_get_interval (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
176 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
177 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
179 return ticker->interval;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
182 void gtk_ticker_set_scootch (GtkTicker *ticker, gint scootch)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
184 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
185 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
187 if (scootch <= 0)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
188 scootch = 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
189 ticker->scootch = scootch;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
190 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
193 guint gtk_ticker_get_scootch (GtkTicker *ticker )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
195 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
196 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
198 return ticker->scootch;
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
201 void gtk_ticker_set_spacing (GtkTicker *ticker, gint spacing )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
203 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
204 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
206 if ( spacing < 0 )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
207 spacing = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
208 ticker->spacing = spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
209 ticker->dirty = TRUE;
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
212 static int ticker_timeout(gpointer data)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 {
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 GtkTicker *ticker = (GtkTicker *) data;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
216 if (GTK_WIDGET_VISIBLE (ticker))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
217 gtk_widget_queue_resize (GTK_WIDGET (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 return( TRUE );
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
222 void gtk_ticker_start_scroll(GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
224 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
225 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 if ( ticker->timer != 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
228 ticker->timer = g_timeout_add(ticker->interval, ticker_timeout, ticker);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
231 void gtk_ticker_stop_scroll(GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
233 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
234 g_return_if_fail (GTK_IS_TICKER (ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 if ( ticker->timer == 0 )
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 return;
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 3466
diff changeset
237 g_source_remove(ticker->timer);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 ticker->timer = 0;
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
241 guint gtk_ticker_get_spacing (GtkTicker *ticker )
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
243 g_return_val_if_fail (ticker != NULL, -1);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
244 g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
246 return ticker->spacing;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
249 static void gtk_ticker_map (GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
251 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
252 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
253 GList *children;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
255 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
256 g_return_if_fail (GTK_IS_TICKER (widget));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
258 GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
259 ticker = GTK_TICKER (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
261 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
262 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
263 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
264 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
265 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
267 if (GTK_WIDGET_VISIBLE (child->widget) &&
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
268 !GTK_WIDGET_MAPPED (child->widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
269 gtk_widget_map (child->widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
270 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
272 gdk_window_show (widget->window);
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
275 static void gtk_ticker_realize (GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
277 GdkWindowAttr attributes;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
278 gint attributes_mask;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
280 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
281 g_return_if_fail (GTK_IS_TICKER (widget));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
283 GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
285 attributes.window_type = GDK_WINDOW_CHILD;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
286 attributes.x = widget->allocation.x;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
287 attributes.y = widget->allocation.y;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
288 attributes.width = widget->allocation.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
289 attributes.height = widget->allocation.height;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
290 attributes.wclass = GDK_INPUT_OUTPUT;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
291 attributes.visual = gtk_widget_get_visual (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
292 attributes.colormap = gtk_widget_get_colormap (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
293 attributes.event_mask = gtk_widget_get_events (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
294 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
296 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
297
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
298 widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
299 &attributes, attributes_mask);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
300 gdk_window_set_user_data (widget->window, widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
302 widget->style = gtk_style_attach (widget->style, widget->window);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
303 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
306 static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
308 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
309 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
310 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
311 GtkRequisition child_requisition;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
313 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
314 g_return_if_fail (GTK_IS_TICKER (widget));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
315 g_return_if_fail (requisition != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
317 ticker = GTK_TICKER (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
318 requisition->width = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
319 requisition->height = 0;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
321 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
322 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
323 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
324 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
325 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
327 if (GTK_WIDGET_VISIBLE (child->widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
328 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
329 gtk_widget_size_request (child->widget, &child_requisition);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
331 requisition->height = MAX (requisition->height,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
332 child_requisition.height);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
333 requisition->width += child_requisition.width + ticker->spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
334 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
336 if ( requisition->width > ticker->spacing )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
337 requisition->width -= ticker->spacing;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
339 requisition->height += GTK_CONTAINER (ticker)->border_width * 2;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
340 requisition->width += GTK_CONTAINER (ticker)->border_width * 2;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 }
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
343 static void gtk_ticker_compute_offsets (GtkTicker *ticker)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
345 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
346 GtkRequisition child_requisition;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
347 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
348 guint16 border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
350 g_return_if_fail (ticker != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
351 g_return_if_fail (GTK_IS_TICKER(ticker));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
353 border_width = GTK_CONTAINER (ticker)->border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
355 ticker->width = GTK_WIDGET(ticker)->allocation.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
356 ticker->total = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
357 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
358 while (children) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
359 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
360
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
361 child->x = 0;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
362 if (GTK_WIDGET_VISIBLE (child->widget)) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
363 gtk_widget_get_child_requisition (child->widget, &child_requisition);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
364 child->offset = ticker->total;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
365 ticker->total +=
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
366 child_requisition.width + border_width + ticker->spacing;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
367 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
368 children = children->next;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
369 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
370 ticker->dirty = FALSE;
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
373 static void gtk_ticker_size_allocate (GtkWidget *widget,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
374 GtkAllocation *allocation)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
376 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
377 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
378 GtkAllocation child_allocation;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
379 GtkRequisition child_requisition;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
380 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
381 guint16 border_width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
382
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
383 g_return_if_fail (widget != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
384 g_return_if_fail (GTK_IS_TICKER(widget));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
385 g_return_if_fail (allocation != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
386
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
387 ticker = GTK_TICKER (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
389 if ( GTK_WIDGET(ticker)->allocation.width != ticker->width )
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
390 ticker->dirty = TRUE;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
392 if ( ticker->dirty == TRUE ) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
393 gtk_ticker_compute_offsets( ticker );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
394 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
396 widget->allocation = *allocation;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
397 if (GTK_WIDGET_REALIZED (widget))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
398 gdk_window_move_resize (widget->window,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
399 allocation->x,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
400 allocation->y,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
401 allocation->width,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
402 allocation->height);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
404 border_width = GTK_CONTAINER (ticker)->border_width;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
406 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
407 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
408 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
409 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
410 child->x -= ticker->scootch;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
412 if (GTK_WIDGET_VISIBLE (child->widget)) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
413 gtk_widget_get_child_requisition (child->widget, &child_requisition);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
414 child_allocation.width = child_requisition.width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
415 child_allocation.x = child->offset + border_width + child->x;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
416 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
417 if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
418 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
419 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
420 else {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
421 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
422 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
423 }
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
424 child_allocation.y = border_width;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
425 child_allocation.height = child_requisition.height;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
426 gtk_widget_size_allocate (child->widget, &child_allocation);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
428 children = children->next;
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
432 void gtk_ticker_add(GtkTicker *ticker, GtkWidget *widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
433 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
434 gtk_ticker_add_real( GTK_CONTAINER( ticker ), widget );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
435 ticker->dirty = TRUE;
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
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
438 void gtk_ticker_remove(GtkTicker *ticker, GtkWidget *widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
439 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
440 gtk_ticker_remove_real( GTK_CONTAINER( ticker ), widget );
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
441 ticker->dirty = TRUE;
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
444 static void gtk_ticker_add_real(GtkContainer *container, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
446 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
447 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
448 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
450 gtk_ticker_put(GTK_TICKER (container), widget);
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
453 static void gtk_ticker_remove_real(GtkContainer *container, GtkWidget *widget)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
455 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
456 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
457 GList *children;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
459 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
460 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
461 g_return_if_fail (widget != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
463 ticker = GTK_TICKER (container);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
465 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
466 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
467 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
468 child = children->data;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
470 if (child->widget == widget)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
471 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
472 gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
473
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
474 gtk_widget_unparent (widget);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
476 ticker->children = g_list_remove_link (ticker->children, children);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
477 g_list_free (children);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
478 g_free (child);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
480 if (was_visible && GTK_WIDGET_VISIBLE (container))
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
481 gtk_widget_queue_resize (GTK_WIDGET (container));
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
483 break;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
484 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
486 children = children->next;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
487 }
3391
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
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
490 static void gtk_ticker_forall (GtkContainer *container,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
491 gboolean include_internals,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
492 GtkCallback callback,
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
493 gpointer callback_data)
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 {
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
495 GtkTicker *ticker;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
496 GtkTickerChild *child;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
497 GList *children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
498
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
499 g_return_if_fail (container != NULL);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
500 g_return_if_fail (GTK_IS_TICKER (container));
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
501 g_return_if_fail (callback != NULL);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
503 ticker = GTK_TICKER (container);
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
505 children = ticker->children;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
506 while (children)
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
507 {
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
508 child = children->data;
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
509 children = children->next;
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
511 (* callback) (child->widget, callback_data);
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
512 }
3391
412d1035d666 [gaim-migrate @ 3410]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 }
5170
13ffa9ae4282 [gaim-migrate @ 5534]
Nathan Walp <nwalp@pidgin.im>
parents: 4635
diff changeset
514