Fix #314: Remote commands for thumbnail maintenance
[geeqie.git] / src / ui_utildlg.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef UI_UTILDLG_H
23 #define UI_UTILDLG_H
24
25
26 #define GENERIC_DIALOG(gd) ((GenericDialog *)gd)
27
28 typedef struct _GenericDialog GenericDialog;
29 struct _GenericDialog
30 {
31         GtkWidget *dialog;      /* window */
32         GtkWidget *vbox;        /* place to add widgets */
33
34         GtkWidget *hbox;        /* button hbox */
35
36         gboolean auto_close;
37
38         void (*default_cb)(GenericDialog *, gpointer);
39         void (*cancel_cb)(GenericDialog *, gpointer);
40         gpointer data;
41
42         /* private */
43         GtkWidget *cancel_button;
44 };
45
46 typedef struct _FileDialog FileDialog;
47 struct _FileDialog
48 {
49         GenericDialog gd;
50
51         GtkWidget *entry;
52
53         gint type;
54
55         FileData *source_fd;
56         GList *source_list;
57
58         gchar *dest_path;
59 };
60
61
62 /* When parent is not NULL, the dialog is set as a transient of the window containing parent */
63 GenericDialog *generic_dialog_new(const gchar *title,
64                                   const gchar *role,
65                                   GtkWidget *parent, gboolean auto_close,
66                                   void (*cancel_cb)(GenericDialog *, gpointer), gpointer data);
67 void generic_dialog_close(GenericDialog *gd);
68
69 GtkWidget *generic_dialog_add_button(GenericDialog *gd, const gchar *stock_id, const gchar *text,
70                                      void (*func_cb)(GenericDialog *, gpointer), gboolean is_default);
71 void generic_dialog_attach_default(GenericDialog *gd, GtkWidget *widget);
72
73 GtkWidget *generic_dialog_add_message(GenericDialog *gd, const gchar *icon_stock_id,
74                                       const gchar *heading, const gchar *text);
75
76 gboolean generic_dialog_get_alternative_button_order(GtkWidget *widget);
77
78 GenericDialog *warning_dialog(const gchar *heading, const gchar *text,
79                               const gchar *icon_stock_id, GtkWidget *parent);
80
81 FileDialog *file_dialog_new(const gchar *title,
82                             const gchar *role,
83                             GtkWidget *parent,
84                             void (*cancel_cb)(FileDialog *, gpointer), gpointer data);
85 void file_dialog_close(FileDialog *fd);
86
87 GtkWidget *file_dialog_add_button(FileDialog *fd, const gchar *stock_id, const gchar *text,
88                                   void (*func_cb)(FileDialog *, gpointer), gboolean is_default);
89
90 /* default_path is default base directory, and is only used if no history
91  *  exists for history_key (HOME is used if default_path is NULL).
92  * path can be a full path or only a file name. If name only, appended to
93  *  the default_path or the last history (see default_path)
94  */
95 void file_dialog_add_path_widgets(FileDialog *fd, const gchar *default_path, const gchar *path,
96                                   const gchar *history_key, const gchar *filter, const gchar *filter_desc);
97
98 void file_dialog_add_filter(FileDialog *fd, const gchar *filter, const gchar *filter_desc, gboolean set);
99 void file_dialog_clear_filter(FileDialog *fd);
100 void file_dialog_sync_history(FileDialog *fd, gboolean dir_only);
101
102
103 #endif
104 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */