xarchive  0.2.8-6
About: XArchive is a GTK+ front-end for command line archiving tools.
  Fossies Dox: xarchive-0.2.8-6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

widgets_gtk.h
Go to the documentation of this file.
1 #ifndef XARCHIVE_SRC_WIDGETS_GTK
2 #define XARCHIVE_SRC_WIDGETS_GTK 1
3 
4 #include"common.h"
5 #include<gtk/gtk.h>
6 #include<gdk/gdk.h>
7 #include<glib/gstdio.h>
8 #include<string.h>
9 #include<sys/wait.h>
10 #include<signal.h>
11 #include<unistd.h>
12 #include"icons/xarchive.xpm"
13 
14 #define TEMP_NAME "xarchiveXXXXXX"
15 
16 /* LOCAL DATA TYPES AND STRUCTURES */
17 typedef struct sel_data
18 {
19  GtkTreeSelection *sel;
20  gchar *dname;
21  gboolean dirs;
23 
24 typedef struct wrapper_data
25 {
26  gchar *dir;
27  gint index;
28  gchar **argv;
29 } WrapperData;
30 
31 /* GLOBAL VARIABLES */
32 GtkUIManager *UIMANAGER;
33 GtkNotebook *NOTEBOOK;
34 GtkWidget *EMPTY;
35 GtkWidget *MAIN_WINDOW;
36 
37 /* EXTERNAL FUNCTIONS */
38 /* from my_strescape */
39 extern char *
40 my_strescape(char *string);
41 
42 /* from main.c */
43 int
44 wrapper_cmd(gint ar_func, gchar **argv, gchar *dest);
45 
46 gchar *
47 get_wrapper(gchar *filename);
48 
49 gchar *
50 wrapper_info(void);
51 
52 /* from myfc.c */
53 void
54 myfc_add_foreach_func(gchar *fpath, GtkListStore *myfc_ls);
55 
56 GtkListStore *
57 make_myfc_ls(void);
58 
59 GtkDialog *
60 make_myfc(gchar *archive, GtkListStore *fclist);
61 
62 /* LOCAL FUNCTIONS */
63 /********************************/
64 /* treeview and model functions */
65 /********************************/
66 void
67 render_cols(GtkTreeView *view, gchar *title, gint mcol);
68 
69 GtkListStore *
70 make_liststore(void);
71 
72 GtkWidget *
73 make_tree(GtkListStore *liststore);
74 
75 GtkTreeView *
76 get_current_tree(void);
77 
78 gchar *
80 
81 void
82 add_row(GtkListStore *liststore, gchar **ent);
83 
84 void
85 reload_current_tree(GtkTreeView *treeview);
86 
87 gboolean
88 treeview_button_press(GtkWidget *container,
89  GdkEventButton *event,
90  GtkUIManager *uimanager);
91 
92 /**********************/
93 /* notebook functions */
94 /**********************/
95 void
96 make_notebook_widgets(GtkWidget *container);
97 
98 void
99 add_page(gchar *archive);
100 
101 /************************************/
102 /* empty page and message functions */
103 /************************************/
104 void
105 setup_opening_progress_bar(GtkWidget *pbwin, GtkWidget *pbar, gboolean *stopit);
106 void
107 wait_with_progress_bar(GPid pid, gint *wrapper_status, gint ar_func);
108 
109 GtkWidget *
110 make_info_widget(gchar *msg);
111 
112 void
113 make_empty_page(GtkWidget *container);
114 
115 gboolean
116 message(GtkWidget *parentwin, gint type, gchar *text);
117 
118 /*********************/
119 /* foreach functions */
120 /*********************/
121 void
122 selected_foreach_func(GtkTreeModel *model,
123  GtkTreePath *path,
124  GtkTreeIter *iter,
125  WrapperData *wrapper);
126 
127 gboolean
128 sel_subdir_foreach_func(GtkTreeModel *model,
129  GtkTreePath *path,
130  GtkTreeIter *iter,
131  SelectionData *seld);
132 
133 gboolean
134 unsel_subdir_foreach_func(GtkTreeModel *model,
135  GtkTreePath *path,
136  GtkTreeIter *iter,
137  SelectionData *seld);
138 
139 gboolean
140 test_selection_func(GtkTreeSelection *selection,
141  GtkTreeModel *model,
142  GtkTreePath *path,
143  gboolean path_currently_selected,
144  gpointer data);
145 
146 gboolean
147 add_foreach_func(GtkTreeModel *model, GtkTreePath *path,
148  GtkTreeIter *iter, WrapperData *wrapper);
149 
150 gboolean
151 file_filter_func(const GtkFileFilterInfo *filter_info, gpointer data);
152 
153 /*******************/
154 /* chooser widgets */
155 /*******************/
156 gchar *
158 
159 gchar *
160 askfor_new_archive(gchar *name);
161 
162 gboolean
163 multi_file_chooser(gchar *archive, GtkListStore *filelist);
164 
165 gchar *
166 askfor_extract_dir(void);
167 
168 /******************************************/
169 /* openwith and default handler functions */
170 /******************************************/
171 GtkListStore *
172 get_openwith_cmdlist(gchar *cmdlist_path);
173 
174 void
175 add_to_cmdlist(GtkListStore *cmdlist, gchar *command, gchar *cmdlist_path);
176 
177 void
178 get_lastdir(void);
179 
180 void
181 get_default_handler(void);
182 
183 void
184 set_default_handler(gchar *command);
185 
186 void
187 open_one_file(WrapperData *wrapper, gchar *command);
188 
189 void
190 default_handler_foreach_func(GtkTreeModel *model,
191  GtkTreePath *path,
192  GtkTreeIter *iter,
193  WrapperData *wrapper);
194 gchar *
195 askfor_openwith_command(gchar *fname);
196 
197 void
198 openwith_foreach_func(GtkTreeModel *model, GtkTreePath *path,
199  GtkTreeIter *iter, WrapperData *wrapper);
200 
201 /**********************/
202 /* callback functions */
203 /**********************/
204 void
205 dummy_cb(GtkWidget *widget, gpointer data);
206 
207 void
208 open_cb(GtkWidget *widget, gpointer data);
209 
210 void
211 new_cb(GtkWidget *widget, gpointer data);
212 
213 void
214 close_cb(GtkWidget *widget, gpointer data);
215 
216 void
217 close_button_cb(GtkWidget *widget, gpointer data);
218 
219 void
220 extract_cb(GtkWidget *widget, gpointer data);
221 
222 void
223 openwith_cb(GtkWidget *widget, gpointer data);
224 
225 void
226 double_click_cb(void);
227 
228 void
229 open_selected_files(gboolean use_default_handler);
230 
231 void
232 add_cb(GtkWidget *widget, gpointer data);
233 
234 void
235 remove_cb(GtkWidget *widget, gpointer data);
236 
237 void
238 select_all_cb(GtkWidget *widget, gpointer data);
239 
240 void
241 unselect_all_cb(GtkWidget *widget, gpointer data);
242 
243 void
244 wrapper_info_cb(GtkWidget *widget, gpointer data);
245 
246 void
247 read_help_cb(GtkWidget *widget, gpointer data);
248 
249 static gboolean
250 open_cancel_cb(GtkWidget *widget, gpointer data);
251 
252 static gboolean
253 process_cancel_cb(GtkWidget *widget, gpointer data);
254 
255 /************************/
256 /* ui manager functions */
257 /************************/
258 GtkUIManager *
259 make_ui_widgets(GtkWidget *window, GtkWidget *container);
260 
261 void
262 add_ui_widget(GtkUIManager *uimanager,
263  GtkWidget *widget,
264  GtkContainer *container);
265 
266 /******************************/
267 /* passed aurgument functions */
268 /******************************/
269 gint
270 ask_create_or_add(gchar *msg);
271 
272 void
274 
275 /*****************/
276 /* main function */
277 /*****************/
278 int
279 make_widgets(ParsedArgs *pargs);
280 
281 #endif
UIMANAGER
GtkUIManager * UIMANAGER
Definition: widgets_gtk.h:32
make_myfc
GtkDialog * make_myfc(gchar *archive, GtkListStore *fclist)
Definition: myfc_gtk.c:207
wrapper_data
Definition: widgets_gtk.h:24
MAIN_WINDOW
GtkWidget * MAIN_WINDOW
Definition: widgets_gtk.h:35
make_tree
GtkWidget * make_tree(GtkListStore *liststore)
Definition: widgets_gtk.c:143
askfor_openwith_command
gchar * askfor_openwith_command(gchar *fname)
Definition: widgets_gtk.c:1182
askfor_extract_dir
gchar * askfor_extract_dir(void)
Definition: widgets_gtk.c:887
EMPTY
GtkWidget * EMPTY
Definition: widgets_gtk.h:34
add_to_cmdlist
void add_to_cmdlist(GtkListStore *cmdlist, gchar *command, gchar *cmdlist_path)
Definition: widgets_gtk.c:994
process_passed_arguments
void process_passed_arguments(ParsedArgs *pargs)
Definition: widgets_gtk.c:1903
get_wrapper
gchar * get_wrapper(gchar *filename)
Definition: main.c:188
select_all_cb
void select_all_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1648
unselect_all_cb
void unselect_all_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1659
read_help_cb
void read_help_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1700
add_page
void add_page(gchar *archive)
Definition: widgets_gtk.c:322
myfc_add_foreach_func
void myfc_add_foreach_func(gchar *fpath, GtkListStore *myfc_ls)
Definition: myfc_gtk.c:22
make_myfc_ls
GtkListStore * make_myfc_ls(void)
Definition: myfc_gtk.c:121
selected_foreach_func
void selected_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, WrapperData *wrapper)
Definition: widgets_gtk.c:590
close_button_cb
void close_button_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1413
process_cancel_cb
static gboolean process_cancel_cb(GtkWidget *widget, gpointer data)
askfor_existing_archive
gchar * askfor_existing_archive(void)
Definition: widgets_gtk.c:721
dummy_cb
void dummy_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1291
sel_data::dname
gchar * dname
Definition: widgets_gtk.h:20
SelectionData
struct sel_data SelectionData
openwith_foreach_func
void openwith_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, WrapperData *wrapper)
Definition: widgets_gtk.c:1250
make_notebook_widgets
void make_notebook_widgets(GtkWidget *container)
Definition: widgets_gtk.c:309
sel_subdir_foreach_func
gboolean sel_subdir_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, SelectionData *seld)
Definition: widgets_gtk.c:609
default_handler_foreach_func
void default_handler_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, WrapperData *wrapper)
Definition: widgets_gtk.c:1145
extract_cb
void extract_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1427
make_ui_widgets
GtkUIManager * make_ui_widgets(GtkWidget *window, GtkWidget *container)
Definition: widgets_gtk.c:1767
render_cols
void render_cols(GtkTreeView *view, gchar *title, gint mcol)
Definition: widgets_gtk.c:85
make_empty_page
void make_empty_page(GtkWidget *container)
Definition: widgets_gtk.c:540
add_row
void add_row(GtkListStore *liststore, gchar **ent)
Definition: widgets_gtk.c:228
new_cb
void new_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1310
parsed_arguments
Definition: common.h:19
get_openwith_cmdlist
GtkListStore * get_openwith_cmdlist(gchar *cmdlist_path)
Definition: widgets_gtk.c:959
sel_data
Definition: widgets_gtk.h:17
open_cancel_cb
static gboolean open_cancel_cb(GtkWidget *widget, gpointer data)
message
gboolean message(GtkWidget *parentwin, gint type, gchar *text)
Definition: widgets_gtk.c:551
wait_with_progress_bar
void wait_with_progress_bar(GPid pid, gint *wrapper_status, gint ar_func)
Definition: widgets_gtk.c:449
set_default_handler
void set_default_handler(gchar *command)
Definition: widgets_gtk.c:1104
setup_opening_progress_bar
void setup_opening_progress_bar(GtkWidget *pbwin, GtkWidget *pbar, gboolean *stopit)
Definition: widgets_gtk.c:420
ask_create_or_add
gint ask_create_or_add(gchar *msg)
Definition: widgets_gtk.c:1880
askfor_new_archive
gchar * askfor_new_archive(gchar *name)
Definition: widgets_gtk.c:757
add_cb
void add_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1560
remove_cb
void remove_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1602
make_info_widget
GtkWidget * make_info_widget(gchar *msg)
Definition: widgets_gtk.c:521
multi_file_chooser
gboolean multi_file_chooser(gchar *archive, GtkListStore *filelist)
Definition: widgets_gtk.c:827
add_foreach_func
gboolean add_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, WrapperData *wrapper)
Definition: widgets_gtk.c:699
get_default_handler
void get_default_handler(void)
Definition: widgets_gtk.c:1074
wrapper_info
gchar * wrapper_info(void)
Definition: main.c:152
openwith_cb
void openwith_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1513
open_cb
void open_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1297
common.h
wrapper_data::index
gint index
Definition: widgets_gtk.h:27
sel_data::dirs
gboolean dirs
Definition: widgets_gtk.h:21
file_filter_func
gboolean file_filter_func(const GtkFileFilterInfo *filter_info, gpointer data)
Definition: widgets_gtk.c:707
sel_data::sel
GtkTreeSelection * sel
Definition: widgets_gtk.h:19
get_lastdir
void get_lastdir(void)
Definition: widgets_gtk.c:1040
add_ui_widget
void add_ui_widget(GtkUIManager *uimanager, GtkWidget *widget, GtkContainer *container)
Definition: widgets_gtk.c:1751
make_widgets
int make_widgets(ParsedArgs *pargs)
Definition: widgets_gtk.c:2002
wrapper_data::dir
gchar * dir
Definition: widgets_gtk.h:26
wrapper_info_cb
void wrapper_info_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1670
unsel_subdir_foreach_func
gboolean unsel_subdir_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, SelectionData *seld)
Definition: widgets_gtk.c:627
test_selection_func
gboolean test_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data)
Definition: widgets_gtk.c:645
NOTEBOOK
GtkNotebook * NOTEBOOK
Definition: widgets_gtk.h:33
treeview_button_press
gboolean treeview_button_press(GtkWidget *container, GdkEventButton *event, GtkUIManager *uimanager)
Definition: widgets_gtk.c:282
reload_current_tree
void reload_current_tree(GtkTreeView *treeview)
Definition: widgets_gtk.c:263
WrapperData
struct wrapper_data WrapperData
open_selected_files
void open_selected_files(gboolean use_default_handler)
Definition: widgets_gtk.c:1525
get_current_archive
gchar * get_current_archive(void)
Definition: widgets_gtk.c:209
wrapper_data::argv
gchar ** argv
Definition: widgets_gtk.h:28
open_one_file
void open_one_file(WrapperData *wrapper, gchar *command)
Definition: widgets_gtk.c:1128
close_cb
void close_cb(GtkWidget *widget, gpointer data)
Definition: widgets_gtk.c:1386
make_liststore
GtkListStore * make_liststore(void)
Definition: widgets_gtk.c:128
double_click_cb
void double_click_cb(void)
Definition: widgets_gtk.c:1519
get_current_tree
GtkTreeView * get_current_tree(void)
Definition: widgets_gtk.c:192
wrapper_cmd
int wrapper_cmd(gint ar_func, gchar **argv, gchar *dest)
my_strescape
char * my_strescape(char *string)