1 /* Gnome Music Player Client (GMPC) 2 * Copyright (C) 2004-2011 Qball Cow <qball@gmpclient.org> 3 * Project homepage: http://gmpclient.org/ 4 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __MISC_H__ 21 #define __MISC_H__ 22 23 #define RANGE(l,u,v) (((v)<(l))?(l):(((v)<(u))?(v):(u))) 24 #include <libmpd/libmpd.h> 25 #include "metadata.h" 26 /** 27 * format time into 28 * Total time: %i days %i hours %i minutes 29 */ 30 gchar * format_time(unsigned long seconds); 31 32 /** 33 * Allows you to prepend a string 34 */ 35 gchar * format_time_real(unsigned long seconds, const gchar *data); 36 37 void mpd_song_markup_escaped(char *buffer, int size, char *markup, mpd_Song *song); 38 39 /** 40 * this draws a 1 pixel border around a pixbuf. 41 * It doesn't work for all color depths (I think) 42 */ 43 void screenshot_add_border (GdkPixbuf *src); 44 45 void open_uri(const gchar *uri); 46 int *split_version(const char *uri); 47 48 MpdData * misc_sort_mpddata(MpdData *data, GCompareDataFunc func, void *user_data); 49 MpdData * misc_sort_mpddata_by_album_disc_track(MpdData *data); 50 MpdData *misc_mpddata_remove_duplicate_songs(MpdData *data); 51 52 53 gchar ** tokenize_string(const gchar *string); 54 55 56 gboolean misc_header_expose_event(GtkWidget *widget, GdkEventExpose *event); 57 void misc_header_style_set_process_containers(GtkWidget *container, GtkStyle *old_style, gpointer data); 58 59 gchar * mpd_song_checksum(const mpd_Song *song); 60 gchar *mpd_song_checksum_type(const mpd_Song * song, MetaDataType type); 61 62 void 63 colorshift_pixbuf(GdkPixbuf *dest, GdkPixbuf *src, int shift); 64 void decolor_pixbuf(GdkPixbuf *dest, GdkPixbuf *src); 65 void darken_pixbuf(GdkPixbuf * dest, guint factor); 66 67 void create_gmpc_paths(void); 68 mpd_Song * mpd_songDup0(const mpd_Song *song); 69 #endif 70