annotate src/audacious/ui_skinned_playlist_slider.c @ 3136:cfd7f8d144fa trunk

forgot new files
author Tomasz Mon <desowin@gmail.com>
date Sat, 21 Jul 2007 20:13:01 +0200
parents
children 19908efce4e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Audacious development team.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "widgets/widgetcore.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "ui_skinned_playlist_slider.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include "main.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30 #include "util.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #include "ui_playlist.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 static GMutex *mutex = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 #define UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_playlist_slider_get_type(), UiSkinnedPlaylistSliderPrivate))
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 typedef struct _UiSkinnedPlaylistSliderPrivate UiSkinnedPlaylistSliderPrivate;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 enum {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 REDRAW,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 LAST_SIGNAL
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 struct _UiSkinnedPlaylistSliderPrivate {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 GtkWidget *fixed;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 SkinPixmapId skin_index;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gint width, height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 gint resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 gint move_x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_playlist_slider_class_init (UiSkinnedPlaylistSliderClass *klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_playlist_slider_init (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static void ui_skinned_playlist_slider_destroy (GtkObject *object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 static void ui_skinned_playlist_slider_realize (GtkWidget *widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static void ui_skinned_playlist_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static void ui_skinned_playlist_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static gboolean ui_skinned_playlist_slider_expose (GtkWidget *widget, GdkEventExpose *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static void ui_skinned_playlist_slider_set_position (GtkWidget *widget, gint y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_playlist_slider_button_press (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static gboolean ui_skinned_playlist_slider_button_release (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 static gboolean ui_skinned_playlist_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static void ui_skinned_playlist_slider_redraw (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 static GtkWidgetClass *parent_class = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 static guint playlist_slider_signals[LAST_SIGNAL] = { 0 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 GType ui_skinned_playlist_slider_get_type() {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static GType playlist_slider_type = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 if (!playlist_slider_type) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 static const GTypeInfo playlist_slider_info = {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 sizeof (UiSkinnedPlaylistSliderClass),
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 (GClassInitFunc) ui_skinned_playlist_slider_class_init,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 sizeof (UiSkinnedPlaylistSlider),
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 0,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 (GInstanceInitFunc) ui_skinned_playlist_slider_init,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 playlist_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaylistSlider", &playlist_slider_info, 0);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 return playlist_slider_type;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 static void ui_skinned_playlist_slider_class_init(UiSkinnedPlaylistSliderClass *klass) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GObjectClass *gobject_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GtkObjectClass *object_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 GtkWidgetClass *widget_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 gobject_class = G_OBJECT_CLASS(klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 object_class = (GtkObjectClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 widget_class = (GtkWidgetClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 parent_class = gtk_type_class (gtk_widget_get_type ());
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 object_class->destroy = ui_skinned_playlist_slider_destroy;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 widget_class->realize = ui_skinned_playlist_slider_realize;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->expose_event = ui_skinned_playlist_slider_expose;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->size_request = ui_skinned_playlist_slider_size_request;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 widget_class->size_allocate = ui_skinned_playlist_slider_size_allocate;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 widget_class->button_press_event = ui_skinned_playlist_slider_button_press;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 widget_class->button_release_event = ui_skinned_playlist_slider_button_release;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->motion_notify_event = ui_skinned_playlist_slider_motion_notify;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 klass->redraw = ui_skinned_playlist_slider_redraw;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 playlist_slider_signals[REDRAW] =
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 G_STRUCT_OFFSET (UiSkinnedPlaylistSliderClass, redraw), NULL, NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistSliderPrivate));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 static void ui_skinned_playlist_slider_init(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 mutex = g_mutex_new();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 playlist_slider->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 priv->move_x = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 GtkWidget* ui_skinned_playlist_slider_new(GtkWidget *fixed, gint x, gint y, gint h) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 UiSkinnedPlaylistSlider *hs = g_object_new (ui_skinned_playlist_slider_get_type (), NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 hs->x = x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 hs->y = y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 priv->width = 8;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 priv->height = h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 priv->fixed = fixed;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 priv->skin_index = SKIN_PLEDIT;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(hs), hs->x, hs->y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 return GTK_WIDGET(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 static void ui_skinned_playlist_slider_destroy(GtkObject *object) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 g_return_if_fail (object != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (object));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 if (GTK_OBJECT_CLASS (parent_class)->destroy)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 static void ui_skinned_playlist_slider_realize(GtkWidget *widget) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 GdkWindowAttr attributes;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 gint attributes_mask;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 g_return_if_fail (widget != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER(widget));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 attributes.x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 attributes.y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 attributes.width = widget->allocation.width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 attributes.height = widget->allocation.height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 attributes.wclass = GDK_INPUT_OUTPUT;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.window_type = GDK_WINDOW_CHILD;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 attributes.event_mask = gtk_widget_get_events(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 attributes.visual = gtk_widget_get_visual(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 attributes.colormap = gtk_widget_get_colormap(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 widget->style = gtk_style_attach(widget->style, widget->window);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 gdk_window_set_user_data(widget->window, widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 static void ui_skinned_playlist_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 requisition->width = priv->width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 requisition->height = priv->height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 static void ui_skinned_playlist_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 g_mutex_lock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 widget->allocation = *allocation;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 if (GTK_WIDGET_REALIZED (widget))
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 playlist_slider->x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 playlist_slider->y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 priv->move_x = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 if (priv->height != widget->allocation.height) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 priv->height = priv->height + priv->resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 g_mutex_unlock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 static gboolean ui_skinned_playlist_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 g_return_val_if_fail (widget != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (widget), FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 g_return_val_if_fail (event != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(ps);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 GdkPixmap *obj = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 GdkGC *gc;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 gc = gdk_gc_new(obj);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 gint num_visible;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 num_visible = playlistwin_list_get_visible_count();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 gint y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 if (playlist_get_length(playlist) > num_visible)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 y = (playlistwin_list_get_first() * (priv->height - 19)) /
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 (playlist_get_length(playlist) - num_visible);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 else
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 y = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 if (y < 0) y=0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 if (y > priv->height - 19) y = priv->height - 19;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 /* FIXME: uses bmp_active_skin->pixmaps directly and may need calibration */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 /* drawing background */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 gint c;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 for (c = 0; c <= priv->height / 29; c++) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 gdk_draw_drawable(obj, gc, bmp_active_skin->pixmaps[SKIN_PLEDIT].pixmap,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 36, 42, 0, c*29, priv->width, 29);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 /* drawing knob */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 gdk_draw_drawable(widget->window, gc, obj, 0, 0, 0, 0, priv->width, priv->height);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 g_object_unref(obj);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 g_object_unref(gc);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 return FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 static void ui_skinned_playlist_slider_set_position(GtkWidget *widget, gint y) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 gint pos;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 y = CLAMP(y, 0, priv->height - 19);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 pos = (y * (playlist_get_length(playlist) - playlistwin_list_get_visible_count())) / (priv->height - 19);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 playlistwin_set_toprow(pos);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 static gboolean ui_skinned_playlist_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 if (event->type == GDK_BUTTON_PRESS) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 if (event->button == 1) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 ps->pressed = TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 gint y = event->y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 ui_skinned_playlist_slider_set_position(widget, y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 static gboolean ui_skinned_playlist_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292 if (event->button == 1) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 ps->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 static gboolean ui_skinned_playlist_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 if (ps->pressed) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 gint y = event->y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 ui_skinned_playlist_slider_set_position(widget, y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 static void ui_skinned_playlist_slider_redraw(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 g_mutex_lock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 if (priv->resize_height)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 gtk_widget_set_size_request(GTK_WIDGET(playlist_slider), priv->width, priv->height+priv->resize_height);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 if (priv->move_x)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 gtk_fixed_move(GTK_FIXED(priv->fixed), GTK_WIDGET(playlist_slider), playlist_slider->x+priv->move_x, playlist_slider->y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 gtk_widget_queue_draw(GTK_WIDGET(playlist_slider));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 g_mutex_unlock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 void ui_skinned_playlist_slider_move_relative(GtkWidget *widget, gint x) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 g_mutex_lock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325 priv->move_x += x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 g_mutex_unlock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 void ui_skinned_playlist_slider_resize_relative(GtkWidget *widget, gint h) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330 g_mutex_lock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 priv->resize_height += h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 g_mutex_unlock(mutex);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 }