annotate src/audacious/ui_skinned_playlist.c @ 3591:74d1f0c78456 trunk

Fix generation of build_stamp.c.
author Jonathan Schleifer <js@h3c.de>
date Fri, 21 Sep 2007 18:13:08 +0200
parents 331bfc72ef66
children 2ca446f02d97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Audacious development team.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 /*
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 * A note about Pango and some funky spacey fonts: Weirdly baselined
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 * fonts, or fonts with weird ascents or descents _will_ display a
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30 * little bit weird in the playlist widget, but the display engine
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 * won't make it look too bad, just a little deranged. I honestly
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 * don't think it's worth fixing (around...), it doesn't have to be
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 * perfectly fitting, just the general look has to be ok, which it
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 * IMHO is.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 * A second note: The numbers aren't perfectly aligned, but in the
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 * end it looks better when using a single Pango layout for each
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 * number.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41
3251
f02623377013 goodbye widgets directory
Tomasz Mon <desowin@gmail.com>
parents: 3224
diff changeset
42 #include "skin.h"
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 #include "ui_skinned_playlist.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 #include "main.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 #include "util.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 #include "ui_playlist.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 #include "input.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 #include "strings.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 #include "playback.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 #include "playlist.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 #include "ui_manager.h"
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
53 #include "ui_fileinfopopup.h"
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 #include "debug.h"
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static PangoFontDescription *playlist_list_font = NULL;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static gint ascent, descent, width_delta_digit_one;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static gboolean has_slant;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static guint padding;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 /* FIXME: the following globals should not be needed. */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 static gint width_approx_letters;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static gint width_colon, width_colon_third;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 static gint width_approx_digits, width_approx_digits_half;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 #define UI_SKINNED_PLAYLIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_playlist_get_type(), UiSkinnedPlaylistPrivate))
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 typedef struct _UiSkinnedPlaylistPrivate UiSkinnedPlaylistPrivate;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 enum {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 REDRAW,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 LAST_SIGNAL
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 };
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 struct _UiSkinnedPlaylistPrivate {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 GtkWidget *fixed;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 SkinPixmapId skin_index;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 gint width, height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 gint resize_width, resize_height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 gint drag_pos;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 gboolean dragging, auto_drag_down, auto_drag_up;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 gint auto_drag_up_tag, auto_drag_down_tag;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 };
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 static void ui_skinned_playlist_class_init (UiSkinnedPlaylistClass *klass);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 static void ui_skinned_playlist_init (UiSkinnedPlaylist *playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 static void ui_skinned_playlist_destroy (GtkObject *object);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 static void ui_skinned_playlist_realize (GtkWidget *widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 static void ui_skinned_playlist_size_request (GtkWidget *widget, GtkRequisition *requisition);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 static void ui_skinned_playlist_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 static gboolean ui_skinned_playlist_expose (GtkWidget *widget, GdkEventExpose *event);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 static gboolean ui_skinned_playlist_button_press (GtkWidget *widget, GdkEventButton *event);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 static gboolean ui_skinned_playlist_button_release (GtkWidget *widget, GdkEventButton *event);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 static gboolean ui_skinned_playlist_motion_notify (GtkWidget *widget, GdkEventMotion *event);
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
94 static gboolean ui_skinned_playlist_leave_notify (GtkWidget *widget, GdkEventCrossing *event);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 static void ui_skinned_playlist_redraw (UiSkinnedPlaylist *playlist);
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
96 static gboolean ui_skinned_playlist_popup_show (gpointer data);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
97 static void ui_skinned_playlist_popup_hide (GtkWidget *widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
98 static void ui_skinned_playlist_popup_timer_start (GtkWidget *widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
99 static void ui_skinned_playlist_popup_timer_stop (GtkWidget *widget);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 static GtkWidgetClass *parent_class = NULL;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 static guint playlist_signals[LAST_SIGNAL] = { 0 };
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 GType ui_skinned_playlist_get_type() {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 static GType playlist_type = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 if (!playlist_type) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 static const GTypeInfo playlist_info = {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 sizeof (UiSkinnedPlaylistClass),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 (GClassInitFunc) ui_skinned_playlist_class_init,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 sizeof (UiSkinnedPlaylist),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 0,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 (GInstanceInitFunc) ui_skinned_playlist_init,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 };
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 playlist_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaylist", &playlist_info, 0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 return playlist_type;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 static void ui_skinned_playlist_class_init(UiSkinnedPlaylistClass *klass) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 GObjectClass *gobject_class;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 GtkObjectClass *object_class;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 GtkWidgetClass *widget_class;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 gobject_class = G_OBJECT_CLASS(klass);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 object_class = (GtkObjectClass*) klass;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 widget_class = (GtkWidgetClass*) klass;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 parent_class = gtk_type_class (gtk_widget_get_type ());
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 object_class->destroy = ui_skinned_playlist_destroy;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 widget_class->realize = ui_skinned_playlist_realize;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 widget_class->expose_event = ui_skinned_playlist_expose;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 widget_class->size_request = ui_skinned_playlist_size_request;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 widget_class->size_allocate = ui_skinned_playlist_size_allocate;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 widget_class->button_press_event = ui_skinned_playlist_button_press;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 widget_class->button_release_event = ui_skinned_playlist_button_release;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 widget_class->motion_notify_event = ui_skinned_playlist_motion_notify;
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
143 widget_class->leave_notify_event = ui_skinned_playlist_leave_notify;
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 klass->redraw = ui_skinned_playlist_redraw;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 playlist_signals[REDRAW] =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 G_STRUCT_OFFSET (UiSkinnedPlaylistClass, redraw), NULL, NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistPrivate));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 static void ui_skinned_playlist_init(UiSkinnedPlaylist *playlist) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 playlist->pressed = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 priv->resize_width = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 priv->resize_height = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 playlist->prev_selected = -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 playlist->prev_min = -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 playlist->prev_max = -1;
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
163
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
164 g_object_set_data(G_OBJECT(playlist), "timer_id", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
165 g_object_set_data(G_OBJECT(playlist), "timer_active", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
166
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
167 GtkWidget *popup = audacious_fileinfopopup_create();
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
168 g_object_set_data(G_OBJECT(playlist), "popup", popup);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
169 g_object_set_data(G_OBJECT(playlist), "popup_active", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
170 g_object_set_data(G_OBJECT(playlist), "popup_position", GINT_TO_POINTER(-1));
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 GtkWidget* ui_skinned_playlist_new(GtkWidget *fixed, gint x, gint y, gint w, gint h) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 UiSkinnedPlaylist *hs = g_object_new (ui_skinned_playlist_get_type (), NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(hs);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 hs->x = x;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 hs->y = y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180 priv->width = w;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 priv->height = h;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 priv->fixed = fixed;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 priv->skin_index = SKIN_PLEDIT;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(hs), hs->x, hs->y);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 return GTK_WIDGET(hs);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 static void ui_skinned_playlist_destroy(GtkObject *object) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 UiSkinnedPlaylist *playlist;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 g_return_if_fail (object != NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 g_return_if_fail (UI_SKINNED_IS_PLAYLIST (object));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 playlist = UI_SKINNED_PLAYLIST (object);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 if (GTK_OBJECT_CLASS (parent_class)->destroy)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 static void ui_skinned_playlist_realize(GtkWidget *widget) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 UiSkinnedPlaylist *playlist;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 GdkWindowAttr attributes;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 gint attributes_mask;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 g_return_if_fail (widget != NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 g_return_if_fail (UI_SKINNED_IS_PLAYLIST(widget));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 playlist = UI_SKINNED_PLAYLIST(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 attributes.x = widget->allocation.x;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 attributes.y = widget->allocation.y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 attributes.width = widget->allocation.width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 attributes.height = widget->allocation.height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 attributes.wclass = GDK_INPUT_OUTPUT;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 attributes.window_type = GDK_WINDOW_CHILD;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 attributes.event_mask = gtk_widget_get_events(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
221 GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 attributes.visual = gtk_widget_get_visual(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 attributes.colormap = gtk_widget_get_colormap(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 widget->style = gtk_style_attach(widget->style, widget->window);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 gdk_window_set_user_data(widget->window, widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 static void ui_skinned_playlist_size_request(GtkWidget *widget, GtkRequisition *requisition) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 requisition->width = priv->width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 requisition->height = priv->height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 static void ui_skinned_playlist_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 UiSkinnedPlaylist *playlist = UI_SKINNED_PLAYLIST (widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 widget->allocation = *allocation;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 if (GTK_WIDGET_REALIZED (widget))
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 playlist->x = widget->allocation.x;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 playlist->y = widget->allocation.y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 if (priv->height != widget->allocation.height || priv->width != widget->allocation.width) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 priv->width = priv->width + priv->resize_width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 priv->height = priv->height + priv->resize_height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 priv->resize_width = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 priv->resize_height = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 gtk_widget_queue_draw(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 static gboolean ui_skinned_playlist_auto_drag_down_func(gpointer data) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(data);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(data);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 if (priv->auto_drag_down) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 ui_skinned_playlist_move_down(pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 pl->first++;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 playlistwin_update_list(playlist_get_active());
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 return TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 return FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 static gboolean ui_skinned_playlist_auto_drag_up_func(gpointer data) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(data);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(data);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 if (priv->auto_drag_up) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 ui_skinned_playlist_move_up(pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 pl->first--;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 playlistwin_update_list(playlist_get_active());
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 return TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 return FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 void ui_skinned_playlist_move_up(UiSkinnedPlaylist * pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 GList *list;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 if (!playlist)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
293 PLAYLIST_LOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 if ((list = playlist->entries) == NULL) {
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
295 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 if (PLAYLIST_ENTRY(list->data)->selected) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 /* We are at the top */
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
300 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 while (list) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 if (PLAYLIST_ENTRY(list->data)->selected)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 glist_moveup(list);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 list = g_list_next(list);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
308 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 if (pl->prev_selected != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 pl->prev_selected--;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 if (pl->prev_min != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 pl->prev_min--;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 if (pl->prev_max != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 pl->prev_max--;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 void ui_skinned_playlist_move_down(UiSkinnedPlaylist * pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 GList *list;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 if (!playlist)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
324 PLAYLIST_LOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 if (!(list = g_list_last(playlist->entries))) {
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
327 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 if (PLAYLIST_ENTRY(list->data)->selected) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 /* We are at the bottom */
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
333 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 return;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 while (list) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 if (PLAYLIST_ENTRY(list->data)->selected)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 glist_movedown(list);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 list = g_list_previous(list);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
343 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 if (pl->prev_selected != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346 pl->prev_selected++;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 if (pl->prev_min != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
348 pl->prev_min++;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 if (pl->prev_max != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350 pl->prev_max++;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 static void
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354 playlist_list_draw_string(GdkPixmap *obj, GdkGC *gc, UiSkinnedPlaylist *pl,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355 PangoFontDescription * font,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356 gint line,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357 gint width,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 const gchar * text,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 guint ppos)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 guint plist_length_int;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 PangoLayout *layout;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 REQUIRE_LOCK(playlist->mutex);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 if (cfg.show_numbers_in_pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 gchar *pos_string = g_strdup_printf(cfg.show_separator_in_pl == TRUE ? "%d" : "%d.", ppos);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369 plist_length_int =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 gint_count_digits(playlist_get_length(playlist)) + !cfg.show_separator_in_pl + 1; /* cf.show_separator_in_pl will be 0 if false */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
371
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 padding = plist_length_int;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373 padding = ((padding + 1) * width_approx_digits);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
374
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375 layout = gtk_widget_create_pango_layout(playlistwin, pos_string);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 pango_layout_set_font_description(layout, playlist_list_font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 pango_layout_set_width(layout, plist_length_int * 100);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 gdk_draw_layout(obj, gc, (width_approx_digits *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383 (-1 + plist_length_int - strlen(pos_string))) +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 (width_approx_digits / 4),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 (line - 1) * pl->fheight +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386 ascent + abs(descent), layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 g_free(pos_string);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 g_object_unref(layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 if (!cfg.show_separator_in_pl)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 padding -= (width_approx_digits * 1.5);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 } else {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393 padding = 3;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396 width -= padding;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
398 layout = gtk_widget_create_pango_layout(playlistwin, text);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
399
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
400 pango_layout_set_font_description(layout, playlist_list_font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
401 pango_layout_set_width(layout, width * PANGO_SCALE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402 pango_layout_set_single_paragraph_mode(layout, TRUE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
403 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
404 gdk_draw_layout(obj, gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
405 padding + (width_approx_letters / 4),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
406 (line - 1) * pl->fheight +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
407 ascent + abs(descent), layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
408
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
409 g_object_unref(layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
410 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
411
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412 static gboolean ui_skinned_playlist_expose(GtkWidget *widget, GdkEventExpose *event) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
413 g_return_val_if_fail (widget != NULL, FALSE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST (widget), FALSE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
415 g_return_val_if_fail (event != NULL, FALSE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
416
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
420 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421 GList *list;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422 PangoLayout *layout;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
423 gchar *title;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
424 gint width, height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
425 gint i, max_first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
426 guint padding, padding_dwidth, padding_plength;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
427 guint max_time_len = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
428 gfloat queue_tailpadding = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
429 gint tpadding;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
430 gsize tpadding_dwidth = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
431 gint x, y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
432 guint tail_width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
433 guint tail_len;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
434
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
435 gchar tail[100];
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
436 gchar queuepos[255];
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
437 gchar length[40];
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
438
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
439 gchar **frags;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
440 gchar *frag0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
441
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
442 gint plw_w, plw_h;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
443
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
444 GdkPixmap *obj = NULL;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
445 GdkGC *gc;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
446
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
447 obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
448 gc = gdk_gc_new(obj);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
449
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
450 GdkRectangle *playlist_rect;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
451
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
452 width = priv->width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
453 height = priv->height;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
454
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
455 plw_w = playlistwin_get_width();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
456 plw_h = playlistwin_get_height();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
457
3514
331bfc72ef66 Convert some things to use GSlice.
William Pitcock <nenolod@atheme.org>
parents: 3511
diff changeset
458 playlist_rect = g_slice_new0(GdkRectangle);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
459
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
460 playlist_rect->x = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
461 playlist_rect->y = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
462 playlist_rect->width = plw_w - 17;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
463 playlist_rect->height = plw_h - 36;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
464
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
465 gdk_gc_set_clip_origin(gc, 31, 58);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
466 gdk_gc_set_clip_rectangle(gc, playlist_rect);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
467
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
468 gdk_gc_set_foreground(gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
469 skin_get_color(bmp_active_skin,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
470 SKIN_PLEDIT_NORMALBG));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
471 gdk_draw_rectangle(obj, gc, TRUE, 0, 0,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
472 width, height);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
473
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
474 if (!playlist_list_font) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
475 g_critical("Couldn't open playlist font");
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
476 return FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
477 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
478
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
479 pl->fheight = (ascent + abs(descent));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
480 pl->num_visible = height / pl->fheight;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
481
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
482 max_first = playlist_get_length(playlist) - pl->num_visible;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
483 max_first = MAX(max_first, 0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
484
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
485 pl->first = CLAMP(pl->first, 0, max_first);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
486
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
487 PLAYLIST_LOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
488 list = playlist->entries;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
489 list = g_list_nth(list, pl->first);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
490
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
491 /* It sucks having to run the iteration twice but this is the only
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
492 way you can reliably get the maximum width so we can get our
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
493 playlist nice and aligned... -- plasmaroo */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
494
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
495 for (i = pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
496 list && i < pl->first + pl->num_visible;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
497 list = g_list_next(list), i++) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
498 PlaylistEntry *entry = list->data;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
499
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
500 if (entry->length != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
501 {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
502 g_snprintf(length, sizeof(length), "%d:%-2.2d",
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
503 entry->length / 60000, (entry->length / 1000) % 60);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
504 tpadding_dwidth = MAX(tpadding_dwidth, strlen(length));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
505 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
506 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
507
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
508 /* Reset */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
509 list = playlist->entries;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
510 list = g_list_nth(list, pl->first);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
511
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
512 for (i = pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
513 list && i < pl->first + pl->num_visible;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
514 list = g_list_next(list), i++) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
515 gint pos;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
516 PlaylistEntry *entry = list->data;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
517
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
518 if (entry->selected) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
519 gdk_gc_set_foreground(gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
520 skin_get_color(bmp_active_skin,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
521 SKIN_PLEDIT_SELECTEDBG));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
522 gdk_draw_rectangle(obj, gc, TRUE, 0,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
523 ((i - pl->first) * pl->fheight),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
524 width, pl->fheight);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
525 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
526
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
527 /* FIXME: entry->title should NEVER be NULL, and there should
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
528 NEVER be a need to do a UTF-8 conversion. Playlist title
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
529 strings should be kept properly. */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
530
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
531 if (!entry->title) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
532 gchar *realfn = g_filename_from_uri(entry->filename, NULL, NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
533 gchar *basename = g_path_get_basename(realfn ? realfn : entry->filename);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
534 title = filename_to_utf8(basename);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
535 g_free(basename); g_free(realfn);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
536 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
537 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
538 title = str_to_utf8(entry->title);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
539
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
540 title = convert_title_text(title);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
541
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
542 pos = playlist_get_queue_position(playlist, entry);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
543
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
544 tail[0] = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
545 queuepos[0] = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
546 length[0] = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
547
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
548 if (pos != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
549 g_snprintf(queuepos, sizeof(queuepos), "%d", pos + 1);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
550
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
551 if (entry->length != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
552 {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
553 g_snprintf(length, sizeof(length), "%d:%-2.2d",
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
554 entry->length / 60000, (entry->length / 1000) % 60);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
555 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
556
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
557 strncat(tail, length, sizeof(tail) - 1);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
558 tail_len = strlen(tail);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
559
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
560 max_time_len = MAX(max_time_len, tail_len);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
561
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
562 if (pos != -1 && tpadding_dwidth <= 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
563 tail_width = width - (width_approx_digits * (strlen(queuepos) + 2.25));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
564 else if (pos != -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
565 tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
566 else if (tpadding_dwidth > 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
567 tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
568 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
569 tail_width = width;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
570
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
571 if (i == playlist_get_position_nolock(playlist))
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
572 gdk_gc_set_foreground(gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
573 skin_get_color(bmp_active_skin,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
574 SKIN_PLEDIT_CURRENT));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
575 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
576 gdk_gc_set_foreground(gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
577 skin_get_color(bmp_active_skin,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
578 SKIN_PLEDIT_NORMAL));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
579 playlist_list_draw_string(obj, gc, pl, playlist_list_font,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
580 i - pl->first, tail_width, title,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
581 i + 1);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
582
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
583 x = width - width_approx_digits * 2;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
584 y = ((i - pl->first) - 1) * pl->fheight + ascent;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
585
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
586 frags = NULL;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
587 frag0 = NULL;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
588
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
589 if ((strlen(tail) > 0) && (tail != NULL)) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
590 frags = g_strsplit(tail, ":", 0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
591 frag0 = g_strconcat(frags[0], ":", NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
592
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
593 layout = gtk_widget_create_pango_layout(playlistwin, frags[1]);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
594 pango_layout_set_font_description(layout, playlist_list_font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
595 pango_layout_set_width(layout, tail_len * 100);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
596 pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
597 gdk_draw_layout(obj, gc, x - (0.5 * width_approx_digits),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
598 y + abs(descent), layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
599 g_object_unref(layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
600
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
601 layout = gtk_widget_create_pango_layout(playlistwin, frag0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
602 pango_layout_set_font_description(layout, playlist_list_font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
603 pango_layout_set_width(layout, tail_len * 100);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
604 pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
605 gdk_draw_layout(obj, gc, x - (0.75 * width_approx_digits),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
606 y + abs(descent), layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
607 g_object_unref(layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
608
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
609 g_free(frag0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
610 g_strfreev(frags);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
611 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
612
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
613 if (pos != -1) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
614
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
615 /* DON'T remove the commented code yet please -- Milosz */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
616
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
617 if (tpadding_dwidth > 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
618 queue_tailpadding = tpadding_dwidth + 1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
619 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
620 queue_tailpadding = -0.75;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
621
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
622 gdk_draw_rectangle(obj, gc, FALSE,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
623 x -
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
624 (((queue_tailpadding +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
625 strlen(queuepos)) *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
626 width_approx_digits) +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
627 (width_approx_digits / 4)),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
628 y + abs(descent),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
629 (strlen(queuepos)) *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
630 width_approx_digits +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
631 (width_approx_digits / 2),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
632 pl->fheight - 2);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
633
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
634 layout =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
635 gtk_widget_create_pango_layout(playlistwin, queuepos);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
636 pango_layout_set_font_description(layout, playlist_list_font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
637 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
638
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
639 gdk_draw_layout(obj, gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
640 x -
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
641 ((queue_tailpadding +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
642 strlen(queuepos)) * width_approx_digits) +
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
643 (width_approx_digits / 4),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
644 y + abs(descent), layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
645 g_object_unref(layout);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
646 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
647
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
648 g_free(title);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
649 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
650
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
651
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
652 /*
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
653 * Drop target hovering over the playlist, so draw some hint where the
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
654 * drop will occur.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
655 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
656 * This is (currently? unfixably?) broken when dragging files from Qt/KDE apps,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
657 * probably due to DnD signaling problems (actually i have no clue).
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
658 *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
659 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
660
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
661 if (pl->drag_motion) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
662 guint pos, plength, lpadding;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
663 gint x, y, plx, ply;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
664
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
665 if (cfg.show_numbers_in_pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
666 lpadding = gint_count_digits(playlist_get_length(playlist)) + 1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
667 lpadding = ((lpadding + 1) * width_approx_digits);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
668 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
669 else {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
670 lpadding = 3;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
671 };
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
672
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
673 /* We already hold the mutex and have the playlist locked, so call
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
674 the non-locking function. */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
675 plength = playlist_get_length(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
676
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
677 x = pl->drag_motion_x;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
678 y = pl->drag_motion_y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
679
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
680 plx = pl->x;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
681 ply = pl->y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
682
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
683 if ((x > pl->x) && !(x > priv->width)) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
684
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
685 if ((y > pl->y)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
686 && !(y > (priv->height + ply))) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
687
3218
018b37cf0730 hasta la vista old widgetcore
Tomasz Mon <desowin@gmail.com>
parents: 3217
diff changeset
688 pos = ((y - pl->y) / pl->fheight) +
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
689 pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
690
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
691 if (pos > (plength)) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
692 pos = plength;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
693 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
694
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
695 gdk_gc_set_foreground(gc,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
696 skin_get_color(bmp_active_skin,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
697 SKIN_PLEDIT_CURRENT));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
698
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
699 gdk_draw_line(obj, gc, 0,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
700 ((pos - pl->first) * pl->fheight),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
701 priv->width - 1,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
702 ((pos - pl->first) * pl->fheight));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
703 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
704
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
705 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
706
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
707 /* When dropping on the borders of the playlist, outside the text area,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
708 * files get appended at the end of the list. Show that too.
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
709 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
710
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
711 if ((y < ply) || (y > priv->height + ply)) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
712 if ((y >= 0) || (y <= (priv->height + ply))) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
713 pos = plength;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
714 gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_PLEDIT_CURRENT));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
715
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
716 gdk_draw_line(obj, gc, 0, ((pos - pl->first) * pl->fheight),
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
717 priv->width - 1, ((pos - pl->first) * pl->fheight));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
718
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
719 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
720 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
721 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
722
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
723 gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMAL));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
724
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
725 if (cfg.show_numbers_in_pl)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
726 {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
727 padding_plength = playlist_get_length(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
728
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
729 if (padding_plength == 0) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
730 padding_dwidth = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
731 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
732 else {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
733 padding_dwidth = gint_count_digits(playlist_get_length(playlist));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
734 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
735
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
736 padding =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
737 (padding_dwidth *
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
738 width_approx_digits) + width_approx_digits;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
739
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
740
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
741 /* For italic or oblique fonts we add another half of the
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
742 * approximate width */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
743 if (has_slant)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
744 padding += width_approx_digits_half;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
745
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
746 if (cfg.show_separator_in_pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
747 gdk_draw_line(obj, gc, padding, 0, padding, priv->height - 1);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
748 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
749 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
750
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
751 if (tpadding_dwidth != 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
752 {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
753 tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
754
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
755 if (has_slant)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
756 tpadding += width_approx_digits_half;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
757
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
758 if (cfg.show_separator_in_pl) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
759 gdk_draw_line(obj, gc, priv->width - tpadding, 0, priv->width - tpadding, priv->height - 1);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
760 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
761 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
762
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
763 gdk_gc_set_clip_origin(gc, 0, 0);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
764 gdk_gc_set_clip_rectangle(gc, NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
765
3468
440877c9360e Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
766 PLAYLIST_UNLOCK(playlist);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
767
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
768 gdk_draw_drawable(widget->window, gc, obj, 0, 0, 0, 0, priv->width, priv->height);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
769
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
770 g_object_unref(obj);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
771 g_object_unref(gc);
3514
331bfc72ef66 Convert some things to use GSlice.
William Pitcock <nenolod@atheme.org>
parents: 3511
diff changeset
772 g_slice_free(GdkRectangle, playlist_rect);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
773
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
774 return FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
775 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
776
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
777 gint ui_skinned_playlist_get_position(GtkWidget *widget, gint x, gint y) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
778 gint iy, length;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
779 gint ret;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
780 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
781 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
782
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
783 if (!pl->fheight)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
784 return -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
785
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
786 if ((length = playlist_get_length(playlist)) == 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
787 return -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
788 iy = y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
789
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
790 ret = (iy / pl->fheight) + pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
791
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
792 if (ret > length - 1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
793 ret = -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
794
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
795 return ret;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
796 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
797
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
798 static gboolean ui_skinned_playlist_button_press(GtkWidget *widget, GdkEventButton *event) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
799 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
800 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
801
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
802 gint nr;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
803 Playlist *playlist = playlist_get_active();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
804
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
805 nr = ui_skinned_playlist_get_position(widget, event->x, event->y);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
806 if (nr == -1)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
807 return FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
808
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
809 if (event->button == 3) {
3370
dbca6c49bdff fix playlist right click behaviour
Tomasz Mon <desowin@gmail.com>
parents: 3365
diff changeset
810 ui_manager_popup_menu_show(GTK_MENU(playlistwin_popup_menu),
dbca6c49bdff fix playlist right click behaviour
Tomasz Mon <desowin@gmail.com>
parents: 3365
diff changeset
811 event->x_root, event->y_root + 5,
dbca6c49bdff fix playlist right click behaviour
Tomasz Mon <desowin@gmail.com>
parents: 3365
diff changeset
812 event->button, event->time);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
813 GList* selection = playlist_get_selected(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
814 if (g_list_find(selection, GINT_TO_POINTER(nr)) == NULL) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
815 playlist_select_all(playlist, FALSE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
816 playlist_select_range(playlist, nr, nr, TRUE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
817 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
818 } else if (event->button == 1) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
819 if (!(event->state & GDK_CONTROL_MASK))
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
820 playlist_select_all(playlist, FALSE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
821
3365
b4ff4ef0211f make queue on click on playlist with GDK_MOD1_MASK working again
Tomasz Mon <desowin@gmail.com>
parents: 3333
diff changeset
822 if ((event->state & GDK_MOD1_MASK))
b4ff4ef0211f make queue on click on playlist with GDK_MOD1_MASK working again
Tomasz Mon <desowin@gmail.com>
parents: 3333
diff changeset
823 playlist_queue_position(playlist, nr);
b4ff4ef0211f make queue on click on playlist with GDK_MOD1_MASK working again
Tomasz Mon <desowin@gmail.com>
parents: 3333
diff changeset
824
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
825 if (event->state & GDK_SHIFT_MASK && pl->prev_selected != -1) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
826 playlist_select_range(playlist, pl->prev_selected, nr, TRUE);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
827 pl->prev_min = pl->prev_selected;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
828 pl->prev_max = nr;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
829 priv->drag_pos = nr - pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
830 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
831 else {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
832 if (playlist_select_invert(playlist, nr)) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
833 if (event->state & GDK_CONTROL_MASK) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
834 if (pl->prev_min == -1) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
835 pl->prev_min = pl->prev_selected;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
836 pl->prev_max = pl->prev_selected;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
837 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
838 if (nr < pl->prev_min)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
839 pl->prev_min = nr;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
840 else if (nr > pl->prev_max)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
841 pl->prev_max = nr;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
842 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
843 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
844 pl->prev_min = -1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
845 pl->prev_selected = nr;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
846 priv->drag_pos = nr - pl->first;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
847 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
848 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
849 if (event->type == GDK_2BUTTON_PRESS) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
850 /*
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
851 * Ungrab the pointer to prevent us from
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
852 * hanging on to it during the sometimes slow
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
853 * playback_initiate().
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
854 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
855 gdk_pointer_ungrab(GDK_CURRENT_TIME);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
856 playlist_set_position(playlist, nr);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
857 if (!playback_get_playing())
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
858 playback_initiate();
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
859 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
860
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
861 priv->dragging = TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
862 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
863 playlistwin_update_list(playlist);
3276
019ce3ee80d8 stop timer on clicks
Tomasz Mon <desowin@gmail.com>
parents: 3274
diff changeset
864 ui_skinned_playlist_popup_hide(widget);
019ce3ee80d8 stop timer on clicks
Tomasz Mon <desowin@gmail.com>
parents: 3274
diff changeset
865 ui_skinned_playlist_popup_timer_stop(widget);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
866
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
867 return TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
868 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
869
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
870 static gboolean ui_skinned_playlist_button_release(GtkWidget *widget, GdkEventButton *event) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
871 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
872
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
873 if (event->button == 1) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
874 priv->dragging = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
875 priv->auto_drag_down = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
876 priv->auto_drag_up = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
877 gtk_widget_queue_draw(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
878 }
3276
019ce3ee80d8 stop timer on clicks
Tomasz Mon <desowin@gmail.com>
parents: 3274
diff changeset
879
019ce3ee80d8 stop timer on clicks
Tomasz Mon <desowin@gmail.com>
parents: 3274
diff changeset
880 ui_skinned_playlist_popup_hide(widget);
019ce3ee80d8 stop timer on clicks
Tomasz Mon <desowin@gmail.com>
parents: 3274
diff changeset
881 ui_skinned_playlist_popup_timer_stop(widget);
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
882 return TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
883 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
884
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
885 static gboolean ui_skinned_playlist_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
886 UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
887 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
888
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
889 gint nr, y, off, i;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
890 if (priv->dragging) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
891 y = event->y;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
892 nr = (y / pl->fheight);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
893 if (nr < 0) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
894 nr = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
895 if (!priv->auto_drag_up) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
896 priv->auto_drag_up = TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
897 priv->auto_drag_up_tag =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
898 g_timeout_add(100, ui_skinned_playlist_auto_drag_up_func, pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
899 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
900 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
901 else if (priv->auto_drag_up)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
902 priv->auto_drag_up = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
903
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
904 if (nr >= pl->num_visible) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
905 nr = pl->num_visible - 1;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
906 if (!priv->auto_drag_down) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
907 priv->auto_drag_down = TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
908 priv->auto_drag_down_tag =
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
909 g_timeout_add(100, ui_skinned_playlist_auto_drag_down_func, pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
910 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
911 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
912 else if (priv->auto_drag_down)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
913 priv->auto_drag_down = FALSE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
914
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
915 off = nr - priv->drag_pos;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
916 if (off) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
917 for (i = 0; i < abs(off); i++) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
918 if (off < 0)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
919 ui_skinned_playlist_move_up(pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
920 else
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
921 ui_skinned_playlist_move_down(pl);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
922
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
923 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
924 playlistwin_update_list(playlist_get_active());
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
925 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
926 priv->drag_pos = nr;
3333
612007382f0c show fileinfopopup only when cfg.show_filepopup_for_tuple is TRUE
Tomasz Mon <desowin@gmail.com>
parents: 3298
diff changeset
927 } else if (cfg.show_filepopup_for_tuple) {
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
928 gint pos = ui_skinned_playlist_get_position(widget, event->x, event->y);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
929 gint cur_pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "popup_position"));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
930 if (pos != cur_pos) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
931 g_object_set_data(G_OBJECT(widget), "popup_position", GINT_TO_POINTER(pos));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
932 ui_skinned_playlist_popup_hide(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
933 ui_skinned_playlist_popup_timer_stop(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
934 if (pos != -1)
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
935 ui_skinned_playlist_popup_timer_start(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
936 }
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
937 }
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
938
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
939 return TRUE;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
940 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
941
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
942 static gboolean ui_skinned_playlist_leave_notify(GtkWidget *widget, GdkEventCrossing *event) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
943 ui_skinned_playlist_popup_hide(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
944 ui_skinned_playlist_popup_timer_stop(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
945
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
946 return FALSE;
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
947 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
948
3217
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
949 static void ui_skinned_playlist_redraw(UiSkinnedPlaylist *playlist) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
950 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
951
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
952 if (priv->resize_height || priv->resize_width)
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
953 gtk_widget_set_size_request(GTK_WIDGET(playlist), priv->width+priv->resize_width, priv->height+priv->resize_height);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
954
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
955 gtk_widget_queue_draw(GTK_WIDGET(playlist));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
956 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
957
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
958 void ui_skinned_playlist_set_font(const gchar * font) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
959 /* Welcome to bad hack central 2k3 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
960 gchar *font_lower;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
961 gint width_temp;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
962 gint width_temp_0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
963
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
964 playlist_list_font = pango_font_description_from_string(font);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
965
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
966 text_get_extents(font,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
967 "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ",
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
968 &width_approx_letters, NULL, &ascent, &descent);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
969
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
970 width_approx_letters = (width_approx_letters / 53);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
971
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
972 /* Experimental: We don't weigh the 1 into total because it's width is almost always
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
973 * very different from the rest
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
974 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
975 text_get_extents(font, "023456789", &width_approx_digits, NULL, NULL,
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
976 NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
977 width_approx_digits = (width_approx_digits / 9);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
978
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
979 /* Precache some often used calculations */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
980 width_approx_digits_half = width_approx_digits / 2;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
981
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
982 /* FIXME: We assume that any other number is broader than the "1" */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
983 text_get_extents(font, "1", &width_temp, NULL, NULL, NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
984 text_get_extents(font, "2", &width_temp_0, NULL, NULL, NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
985
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
986 if (abs(width_temp_0 - width_temp) < 2) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
987 width_delta_digit_one = 0;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
988 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
989 else {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
990 width_delta_digit_one = ((width_temp_0 - width_temp) / 2) + 2;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
991 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
992
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
993 text_get_extents(font, ":", &width_colon, NULL, NULL, NULL);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
994 width_colon_third = width_colon / 4;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
995
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
996 font_lower = g_utf8_strdown(font, strlen(font));
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
997 /* This doesn't take any i18n into account, but i think there is none with TTF fonts
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
998 * FIXME: This can probably be retrieved trough Pango too
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
999 */
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1000 has_slant = g_strstr_len(font_lower, strlen(font_lower), "oblique")
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1001 || g_strstr_len(font_lower, strlen(font_lower), "italic");
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1002
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1003 g_free(font_lower);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1004 }
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1005
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1006 void ui_skinned_playlist_resize_relative(GtkWidget *widget, gint w, gint h) {
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1007 UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1008 priv->resize_width += w;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1009 priv->resize_height += h;
764e8f87c186 port PlayList_List to gtk2
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1010 }
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1011
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1012 static gboolean ui_skinned_playlist_popup_show(gpointer data) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1013 GtkWidget *widget = data;
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1014 gint pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "popup_position"));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1015
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1016 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "timer_active")) == 1 && pos != -1) {
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3276
diff changeset
1017 Tuple *tuple;
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1018 Playlist *pl_active = playlist_get_active();
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1019 GtkWidget *popup = g_object_get_data(G_OBJECT(widget), "popup");
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1020
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1021 tuple = playlist_get_tuple(pl_active, pos);
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3370
diff changeset
1022 if ((tuple == NULL) || (tuple_get_int(tuple, FIELD_LENGTH, NULL) < 1)) {
3271
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1023 gchar *title = playlist_get_songtitle(pl_active, pos);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1024 audacious_fileinfopopup_show_from_title(popup, title);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1025 g_free(title);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1026 } else {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1027 audacious_fileinfopopup_show_from_tuple(popup , tuple);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1028 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1029 g_object_set_data(G_OBJECT(widget), "popup_active" , GINT_TO_POINTER(1));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1030 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1031
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1032 ui_skinned_playlist_popup_timer_stop(widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1033 return FALSE;
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1034 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1035
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1036 static void ui_skinned_playlist_popup_hide(GtkWidget *widget) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1037 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "popup_active")) == 1) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1038 GtkWidget *popup = g_object_get_data(G_OBJECT(widget), "popup");
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1039 g_object_set_data(G_OBJECT(widget), "popup_active", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1040 audacious_fileinfopopup_hide(popup, NULL);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1041 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1042 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1043
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1044 static void ui_skinned_playlist_popup_timer_start(GtkWidget *widget) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1045 gint timer_id = g_timeout_add(cfg.filepopup_delay*100, ui_skinned_playlist_popup_show, widget);
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1046 g_object_set_data(G_OBJECT(widget), "timer_id", GINT_TO_POINTER(timer_id));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1047 g_object_set_data(G_OBJECT(widget), "timer_active", GINT_TO_POINTER(1));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1048 }
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1049
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1050 static void ui_skinned_playlist_popup_timer_stop(GtkWidget *widget) {
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1051 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "timer_active")) == 1)
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1052 g_source_remove(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "timer_id")));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1053
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1054 g_object_set_data(G_OBJECT(widget), "timer_id", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1055 g_object_set_data(G_OBJECT(widget), "timer_active", GINT_TO_POINTER(0));
5f40f7d2887f better way to show fileinfopopup
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
1056 }