cdfd82ec626274c0e6e2cf9a5a080caceb019e7d
[geeqie.git] / src / ui_utildlg.h
1 /*
2  * (SLIK) SimpLIstic sKin functions
3  * (C) 2004 John Ellis
4  *
5  * Author: John Ellis
6  *
7  * This software is released under the GNU General Public License (GNU GPL).
8  * Please read the included file COPYING for more information.
9  * This software comes with no warranty of any kind, use at your own risk!
10  */
11
12 #ifndef UI_UTILDLG_H
13 #define UI_UTILDLG_H
14
15
16 #define GENERIC_DIALOG(gd) ((GenericDialog *)gd)
17
18 typedef struct _GenericDialog GenericDialog;
19 struct _GenericDialog
20 {
21         GtkWidget *dialog;      /* window */
22         GtkWidget *vbox;        /* place to add widgets */
23
24         GtkWidget *hbox;        /* button hbox */
25
26         gint auto_close;
27
28         void (*default_cb)(GenericDialog *, gpointer);
29         void (*cancel_cb)(GenericDialog *, gpointer);
30         gpointer data;
31
32         /* private */
33         GtkWidget *cancel_button;
34 };
35
36 typedef struct _FileDialog FileDialog;
37 struct _FileDialog
38 {
39         GenericDialog gd;
40
41         GtkWidget *entry;
42
43         gint type;
44         gint multiple_files;
45
46         FileData *source_fd;
47         GList *source_list;
48
49         gchar *dest_path;
50 };
51
52
53 /* When parent is not NULL, the dialog is set as a transient of the window containing parent */
54 GenericDialog *generic_dialog_new(const gchar *title,
55                                   const gchar *wmclass, const gchar *wmsubclass,
56                                   GtkWidget *parent, gint auto_close,
57                                   void (*cancel_cb)(GenericDialog *, gpointer), gpointer data);
58 void generic_dialog_close(GenericDialog *gd);
59
60 GtkWidget *generic_dialog_add_button(GenericDialog *gd, const gchar *stock_id, const gchar *text,
61                                      void (*func_cb)(GenericDialog *, gpointer), gint is_default);
62 void generic_dialog_attach_default(GenericDialog *gd, GtkWidget *widget);
63
64 GtkWidget *generic_dialog_add_message(GenericDialog *gd, const gchar *icon_stock_id,
65                                       const gchar *heading, const gchar *text);
66
67 gint generic_dialog_get_alternative_button_order(GtkWidget *widget);
68
69 GenericDialog *warning_dialog(const gchar *heading, const gchar *text,
70                               const gchar *icon_stock_id, GtkWidget *parent);
71
72 FileDialog *file_dialog_new(const gchar *title,
73                             const gchar *wmclass, const gchar *wmsubclass,
74                             GtkWidget *parent,
75                             void (*cancel_cb)(FileDialog *, gpointer), gpointer data);
76 void file_dialog_close(FileDialog *fd);
77
78 GtkWidget *file_dialog_add_button(FileDialog *fd, const gchar *stock_id, const gchar *text,
79                                   void (*func_cb)(FileDialog *, gpointer), gint is_default);
80
81 /* default_path is default base directory, and is only used if no history
82  *  exists for history_key (HOME is used if default_path is NULL).
83  * path can be a full path or only a file name. If name only, appended to
84  *  the default_path or the last history (see default_path)
85  */
86 void file_dialog_add_path_widgets(FileDialog *fd, const gchar *default_path, const gchar *path,
87                                   const gchar *history_key, const gchar *filter, const gchar *filter_desc);
88
89 void file_dialog_add_filter(FileDialog *fd, const gchar *filter, const gchar *filter_desc, gint set);
90 void file_dialog_clear_filter(FileDialog *fd);
91 void file_dialog_sync_history(FileDialog *fd, gint dir_only);
92
93
94 #endif