1 /*
2 	main_window.h
3 
4 
5 
6 	2003  Plus Huang
7  */
8 
9 #ifndef __MAIN_WINDOW_H
10 #define __MAIN_WINDOW_H
11 
12 #include <gtk/gtk.h>
13 #include "category_store.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 typedef struct _MainWindow   MainWindow;
20 typedef struct _FileMenu     FileMenu;
21 typedef struct _GlobalMenu   GlobalMenu;
22 typedef struct _CategoryMenu CategoryMenu;
23 typedef struct _DownloadMenu DownloadMenu;
24 typedef struct _HelpMenu     HelpMenu;
25 
26 struct _FileMenu
27 {
28 	GtkMenu*    self;
29 
30 	GtkWidget*    load;
31 	GtkWidget*    save;
32 	GtkWidget*    save_as;
33 	GtkWidget*    import_html;
34 	GtkWidget*    export;
35 };
36 
37 struct _GlobalMenu
38 {
39 	GtkMenu*    self;
40 
41 	GtkWidget*    start_job;
42 	GtkWidget*    stop_all;
43 	GtkWidget*    category_default;
44 	GtkWidget*    setting;
45 	GtkWidget*    about;
46 };
47 
48 struct _CategoryMenu
49 {
50 	GtkMenu*    self;
51 
52 	GtkWidget*  new_category;
53 	GtkWidget*  erase_category;
54 	GtkWidget*  properties;
55 };
56 
57 struct _DownloadMenu
58 {
59 	GtkMenu*    self;
60 
61 	GtkWidget*  new_download;
62 	GtkWidget*  add_batch;
63 	GtkWidget*  erase;
64 	GtkWidget*  move_to;
65 	GtkWidget*  move_top;
66 	GtkWidget*  move_bottom;
67 	GtkWidget*  start;
68 	GtkWidget*  stop;
69 	GtkWidget*  properties;
70 };
71 
72 struct _HelpMenu
73 {
74 	GtkMenu* self;
75 
76 	GtkWidget*  about_urlgfe;
77 };
78 
79 void file_menu_init (FileMenu* fm);
80 void global_menu_init (GlobalMenu* gm);
81 void category_menu_init (CategoryMenu* cm);
82 void download_menu_init (DownloadMenu* dm);
83 void help_menu_init (HelpMenu* hm);
84 
85 // MainWindow
86 struct _MainWindow {
87 	GtkWindow*    self;
88 
89 	GtkWidget*    vbox_download;
90 	GtkWidget*    vbox;
91 	GtkPaned*     hpaned;
92 	GtkPaned*     vpaned;
93 	GtkTreeView*  category_view;
94 	GtkStatusbar* statusbar;
95 	// text view
96 	GtkTextView*  text_view;
97 	GtkTextTag*   text_tag;
98 
99 	// menus
100 	GtkWidget*    menu_bar;
101 	FileMenu      file_menu;
102 	GlobalMenu    global_menu;
103 	CategoryMenu  category_menu;
104 	DownloadMenu  download_menu;
105 	HelpMenu      help_menu;
106 
107 	// Download toolbar
108 	GtkWidget*   button_start;
109 	GtkWidget*   button_stop;
110 	GtkWidget*   button_new;
111 	GtkWidget*   button_batch;
112 	GtkWidget*   button_erase;
113 	GtkWidget*   button_property;
114 	GtkWidget*   button_move_top;
115 	GtkWidget*   button_move_bottom;
116 
117 	// other data
118 	DownloadListView* current_download_view;
119 	Category*         current_category;
120 	CategoryStore*    category_store;
121 };
122 
123 
124 void main_window_init (MainWindow* mw,
125                        CategoryStore* c_store);
126 void main_window_set_download_view (MainWindow* mw,
127                                     DownloadListView* dlv);
128 void main_window_update_download_view (MainWindow* mw);
129 
130 void main_window_decide_download_sensitive (MainWindow* mw);
131 void main_window_set_download_sensitive (MainWindow* mw, gboolean sens);
132 void main_window_set_category_sensitive (MainWindow* mw, gboolean sens);
133 
134 void main_window_selection_changed (MainWindow* mw);
135 
136 void main_window_text_view_update (MainWindow* mw);
137 void main_window_text_view_show (MainWindow* mw, Download* dl);
138 void main_window_text_view_decide_update (MainWindow* mw, GtkTreePath* path);
139 
140 void main_window_connect_download_view (MainWindow* mw,
141                                         DownloadListView* dlv);
142 
143 void main_window_on_category_erasing (MainWindow* mw, Category* erasing);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif  // End of __MAIN_WINDOW_H
150 
151