1 /*                                                     -*- linux-c -*-
2     Copyright (C) 2007 Tom Szilagyi
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18     $Id: utils_gui.h 1295 2014-05-04 22:07:31Z tszilagyi $
19 */
20 
21 #ifndef AQUALUNG_UTILS_GUI_H
22 #define AQUALUNG_UTILS_GUI_H
23 
24 #include <config.h>
25 
26 #include <glib.h>
27 #include <gtk/gtk.h>
28 
29 
30 enum {
31 	TOP_WIN_SKIN = (1 << 0),
32 	TOP_WIN_TRAY = (1 << 1)
33 };
34 
35 void register_toplevel_window(GtkWidget * window, int flag);
36 void unregister_toplevel_window(GtkWidget * window);
37 void toplevel_window_foreach(int flag, void (* callback)(GtkWidget * window));
38 
39 
40 enum {
41 	FILE_CHOOSER_FILTER_NONE = 0,
42 	FILE_CHOOSER_FILTER_AUDIO,
43 	FILE_CHOOSER_FILTER_PLAYLIST,
44 	FILE_CHOOSER_FILTER_STORE,
45 	FILE_CHOOSER_FILTER_ETF
46 };
47 
48 
49 #ifdef HAVE_SYSTRAY
50 int get_systray_semaphore(void);
51 #endif /* HAVE_SYSTRAY */
52 
53 gint aqualung_dialog_run(GtkDialog * dialog);
54 guint aqualung_idle_add(GSourceFunc function, gpointer data);
55 guint aqualung_timeout_add(guint interval, GSourceFunc function, gpointer data);
56 
57 void aqualung_tooltips_set_enabled(gboolean enabled);
58 #ifdef HAVE_SYSTRAY
59 void aqualung_status_icon_set_tooltip_text(GtkStatusIcon * icon, const gchar * text);
60 #endif /* HAVE_SYSTRAY */
61 void aqualung_widget_set_tooltip_text(GtkWidget * widget, const gchar * text);
62 
63 GtkWidget* gui_stock_label_button(gchar *label, const gchar *stock);
64 
65 GSList * file_chooser(char * title, GtkWidget * parent,
66 		      GtkFileChooserAction action, int filter, gint multiple, char * destpath);
67 void file_chooser_with_entry(char * title, GtkWidget * parent,
68 			     GtkFileChooserAction action, int filter, GtkWidget * entry, char * destpath);
69 
70 int message_dialog(char * title, GtkWidget * parent, GtkMessageType type,
71 		   GtkButtonsType buttons, GtkWidget * extra, char * text, ...);
72 
73 void insert_label_entry(GtkWidget * table, char * ltext, GtkWidget ** entry,
74 			char * etext, int y1, int y2, gboolean editable);
75 
76 void insert_label_entry_browse(GtkWidget * table, char * ltext, GtkWidget ** entry,
77 			       char * etext, int y1, int y2,
78 			       void (* browse_cb)(GtkButton * button, gpointer data));
79 
80 void insert_label_entry_button(GtkWidget * table, char * ltext, GtkWidget ** entry,
81 			       char * etext, GtkWidget * button, int y1, int y2);
82 
83 void insert_label_progbar_button(GtkWidget * table, char * ltext, GtkWidget ** progbar,
84 				 GtkWidget * button, int y1, int y2);
85 
86 void insert_label_spin(GtkWidget * table, char * ltext, GtkWidget ** spin,
87 		       int spinval, int y1, int y2);
88 
89 void insert_label_spin_with_limits(GtkWidget * table, char * ltext, GtkWidget ** spin,
90 				   double spinval, double min, double max, int y1, int y2);
91 
92 void set_option_from_toggle(GtkWidget * widget, int * opt);
93 void set_option_from_combo(GtkWidget * widget, int * opt);
94 void set_option_from_spin(GtkWidget * widget, int * opt);
95 void set_option_from_entry(GtkWidget * widget, char * opt, int n);
96 void set_option_bit_from_toggle(GtkWidget * toggle, int * opt, int bit);
97 
98 gboolean tree_model_leaf_iter(GtkTreeModel * model, GtkTreeIter * iter, gboolean last, GtkTreeIter * out);
99 gboolean tree_model_next_iter(GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * next, int mindepth);
100 gboolean tree_model_prev_iter(GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * prev, int mindepth);
101 
102 #endif /* AQUALUNG_UTILS_GUI_H */
103 
104 // vim: shiftwidth=8:tabstop=8:softtabstop=8:
105 
106