Cleanup main.h header
[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 #include <gtk/gtk.h>
26
27 struct FileData;
28
29 #define GENERIC_DIALOG(gd) ((GenericDialog *)gd)
30
31 struct GenericDialog
32 {
33         GtkWidget *dialog;      /**< window */
34         GtkWidget *vbox;        /**< place to add widgets */
35
36         GtkWidget *hbox;        /**< button hbox */
37
38         gboolean auto_close;
39
40         void (*default_cb)(GenericDialog *, gpointer);
41         void (*cancel_cb)(GenericDialog *, gpointer);
42         gpointer data;
43
44         GtkWidget *cancel_button; /**< private */
45
46 };
47
48 struct FileDialog
49 {
50         GenericDialog gd;
51
52         GtkWidget *entry;
53
54         gint type;
55
56         FileData *source_fd;
57         GList *source_list;
58
59         gchar *dest_path;
60 };
61
62
63 /**
64  * @headerfile generic_dialog_new
65  * When parent is not NULL, the dialog is set as a transient of the window containing parent
66  */
67 GenericDialog *generic_dialog_new(const gchar *title,
68                                   const gchar *role,
69                                   GtkWidget *parent, gboolean auto_close,
70                                   void (*cancel_cb)(GenericDialog *, gpointer), gpointer data);
71 void generic_dialog_close(GenericDialog *gd);
72
73 GtkWidget *generic_dialog_add_button(GenericDialog *gd, const gchar *icon_name, const gchar *text,
74                                      void (*func_cb)(GenericDialog *, gpointer), gboolean is_default);
75 void generic_dialog_attach_default(GenericDialog *gd, GtkWidget *widget);
76
77 GtkWidget *generic_dialog_add_message(GenericDialog *gd, const gchar *icon_name,
78                                       const gchar *heading, const gchar *text, gboolean expand);
79
80 gboolean generic_dialog_get_alternative_button_order(GtkWidget *widget);
81
82 GenericDialog *warning_dialog(const gchar *heading, const gchar *text,
83                               const gchar *icon_name, GtkWidget *parent);
84
85 FileDialog *file_dialog_new(const gchar *title,
86                             const gchar *role,
87                             GtkWidget *parent,
88                             void (*cancel_cb)(FileDialog *, gpointer), gpointer data);
89 void file_dialog_close(FileDialog *fd);
90
91 GtkWidget *file_dialog_add_button(FileDialog *fd, const gchar *stock_id, const gchar *text,
92                                   void (*func_cb)(FileDialog *, gpointer), gboolean is_default);
93
94 /**
95  * @headerfile file_dialog_add_path_widgets
96  * default_path is default base directory, and is only used if no history
97  * exists for history_key (HOME is used if default_path is NULL).
98  * path can be a full path or only a file name. If name only, appended to
99  * the default_path or the last history (see default_path)
100  */
101 void file_dialog_add_path_widgets(FileDialog *fd, const gchar *default_path, const gchar *path,
102                                   const gchar *history_key, const gchar *filter, const gchar *filter_desc);
103
104 void file_dialog_clear_filter(FileDialog *fd);
105 void file_dialog_sync_history(FileDialog *fd, gboolean dir_only);
106
107 void generic_dialog_windows_load_config(const gchar **attribute_names, const gchar **attribute_values);
108 void generic_dialog_windows_write_config(GString *outstr, gint indent);
109
110 void appimage_notification();
111 #endif
112 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */