Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 322 lines (248 sloc) 7.429 kb
9ac27960 » robm
2009-05-07 moved bindings to uzbl.bindings
1 /*
2 * See LICENSE for license details
3 *
4 * Changelog:
5 * ---------
6 *
7 * (c) 2009 by Robert Manea
8 * - introduced struct concept
9 * - statusbar template
10 *
11 */
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
12
02710b3e » robm
2009-05-08 added default status_format
13 #define STATUS_DEFAULT "<span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%) <b>TITLE</b> - Uzbl browser"
14
b329cac4 » DuClare
2009-05-15 Add SET handling for useragent.
15 enum {
16 /* statusbar symbols */
17 SYM_TITLE, SYM_URI, SYM_NAME,
18 SYM_LOADPRGS, SYM_LOADPRGSBAR,
19 SYM_KEYCMD, SYM_MODE, SYM_MSG,
20 /* useragent symbols */
21 SYM_WK_MAJ, SYM_WK_MIN, SYM_WK_MIC,
22 SYM_SYSNAME, SYM_NODENAME,
23 SYM_KERNREL, SYM_KERNVER,
24 SYM_ARCHSYS, SYM_ARCHUZBL,
25 SYM_DOMAINNAME, SYM_COMMIT
26 };
27
ef4b3ca7 » robm
2009-05-06 refactored status bar template symbol definition and setup
28 const struct {
29 gchar *symbol_name;
ba6aeb5e » DuClare
2009-05-15 Revert "Fix warnings caused by casts between ints and pointers on 64bit"
30 guint symbol_token;
ef4b3ca7 » robm
2009-05-06 refactored status bar template symbol definition and setup
31 } symbols[] = {
32 {"NAME", SYM_NAME},
33 {"URI", SYM_URI},
34 {"TITLE", SYM_TITLE},
448aa221 » robm
2009-05-06 added KEYCMD to statusbar template
35 {"KEYCMD", SYM_KEYCMD},
f7abb5ef » robm
2009-05-06 added MODE symbol to statusbar template
36 {"MODE", SYM_MODE},
9e0d6723 » robm
2009-05-12 added status_msg and MSG to status template
37 {"MSG", SYM_MSG},
ef4b3ca7 » robm
2009-05-06 refactored status bar template symbol definition and setup
38 {"LOAD_PROGRESS", SYM_LOADPRGS},
39 {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR},
b329cac4 » DuClare
2009-05-15 Add SET handling for useragent.
40
41 {"WEBKIT_MAJOR", SYM_WK_MAJ},
42 {"WEBKIT_MINOR", SYM_WK_MIN},
43 {"WEBKIT_MICRO", SYM_WK_MIC},
44 {"SYSNAME", SYM_SYSNAME},
45 {"NODENAME", SYM_NODENAME},
46 {"KERNREL", SYM_KERNREL},
47 {"KERNVER", SYM_KERNVER},
48 {"ARCH_SYSTEM", SYM_ARCHSYS},
49 {"ARCH_UZBL", SYM_ARCHUZBL},
50 {"DOMAINNAME", SYM_DOMAINNAME},
51 {"COMMIT", SYM_COMMIT},
ef4b3ca7 » robm
2009-05-06 refactored status bar template symbol definition and setup
52 {NULL, 0}
53 }, *symp = symbols;
54
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
55 /* status bar elements */
56 typedef struct {
57 gint load_progress;
9e0d6723 » robm
2009-05-12 added status_msg and MSG to status template
58 gchar *msg;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
59 } StatusBar;
60
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
61
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
62 /* gui elements */
63 typedef struct {
64 GtkWidget* main_window;
d6edddd2 » robm
2009-05-15 added status_top to cmd parser
65 GtkWidget* scrolled_win;
66 GtkWidget* vbox;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
67 GtkWidget* mainbar;
68 GtkWidget* mainbar_label;
69 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
70 GtkScrollbar* scbar_h; // (These are still hidden)
71 GtkAdjustment* bar_v; // Information about document length
72 GtkAdjustment* bar_h; // and scrolling position
73 WebKitWebView* web_view;
74 gchar* main_title;
75
76 StatusBar sbar;
77 } GUI;
78
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
79
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
80 /* external communication*/
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
81 enum { FIFO, SOCKET};
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
82 typedef struct {
6aa99a6a » DuClare
2009-05-14 Added functionality for (re)setting fifo_dir.
83 gchar *fifo_path;
84 gchar *socket_path;
06decd11 » robm
2009-05-12 first partially working command parser
85 /* stores (key)"variable name" -> (value)"pointer to this var*/
86 GHashTable *proto_var;
87 /* command parsing regexes */
f2c90543 » DuClare
2009-05-13 Added CMD <foo> for invoking core commands via stdin and scripts.
88 GRegex *set_regex;
89 GRegex *cmd_regex;
fd4821b6 » DuClare
2009-05-16 Move execution from key_press_cb to its own function, run_keycmd.
90 GRegex *keycmd_regex;
06decd11 » robm
2009-05-12 first partially working command parser
91 GRegex *get_regex;
92 GRegex *bind_regex;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
93 } Communication;
94
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
95
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
96 /* internal state */
97 typedef struct {
98 gchar *uri;
99 gchar *config_file;
06decd11 » robm
2009-05-12 first partially working command parser
100 char *instance_name;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
101 gchar config_file_path[500];
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
102 gchar selected_url[500];
103 char executable_path[500];
104 GString* keycmd;
105 gchar searchtx[500];
106 struct utsname unameinfo; /* system info */
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
107 } State;
108
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
109
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
110 /* networking */
0dc558f8 » robm
2009-05-05 Refactored networking variables to use the new struct concept
111 typedef struct {
112 SoupSession *soup_session;
113 SoupLogger *soup_logger;
114 char *proxy_url;
115 char *useragent;
116 gint max_conns;
117 gint max_conns_host;
118 } Network;
119
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
120
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
121 /* behaviour */
122 typedef struct {
702868aa » DuClare
2009-05-13 Added load_finish_handler, call when a page has finished loading.
123 gchar* load_finish_handler;
9155f753 » Dieterbe
2009-05-08 support for changing the background color of the statusbar correctly
124 gchar* status_format;
125 gchar* status_background;
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
126 gchar* history_handler;
127 gchar* fifo_dir;
128 gchar* socket_dir;
129 gchar* download_handler;
130 gchar* cookie_handler;
131 gboolean always_insert_mode;
132 gboolean show_status;
133 gboolean insert_mode;
134 gboolean status_top;
d5f76f3e » Dieterbe
2009-05-14 better name for resetting to command mode
135 gboolean reset_command_mode;
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
136 gchar* modkey;
137 guint modmask;
138 guint http_debug;
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
139
140 /* command list: name -> Command */
141 GHashTable* commands;
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
142 } Behaviour;
143
0dc558f8 » robm
2009-05-05 Refactored networking variables to use the new struct concept
144
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
145 /* main uzbl data structure */
146 typedef struct {
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
147 GUI gui;
148 State state;
149 Network net;
150 Behaviour behave;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
151 Communication comm;
8f3fa4d0 » robm
2009-05-07 Move globals to structs, one more round. introducing struct Behaviour
152
153 Window xwin;
154 GScanner *scan;
9ac27960 » robm
2009-05-07 moved bindings to uzbl.bindings
155
156 /* group bindings: key -> action */
157 GHashTable* bindings;
96c22d0e » anydot
2009-05-04 Move global variables into structs, first round
158 } Uzbl;
159
a7ffb384 » robm
2009-05-07 move globals to structs, another round.
160
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
161 typedef struct {
162 char* name;
163 char* param;
164 } Action;
165
fc2bff84 » robm
2009-05-07 added signal handling and a clean_up() function
166 typedef void sigfunc(int);
50d7e59d » Dieterbe
2009-05-02 merge robm changes: instance naming + better socket code
167
52476946 » robm
2009-05-05 removed eprint() and estrdup() from uzbl.h
168 /* Functions */
fdb283bb » robm
2009-05-05 Added a statusbar parser that allows using arbitrary templates for th…
169 static void
170 setup_scanner();
171
50d7e59d » Dieterbe
2009-05-02 merge robm changes: instance naming + better socket code
172 char *
173 itos(int val);
174
fc2bff84 » robm
2009-05-07 added signal handling and a clean_up() function
175 static void
176 clean_up(void);
177
178 static void
179 catch_sigterm(int s);
180
181 static sigfunc *
182 setup_signal(int signe, sigfunc *shandler);
183
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
184 static gboolean
185 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
186
187 WebKitWebView*
188 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
189
190 static gboolean
191 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
192
193 static void
194 toggle_status_cb (WebKitWebView* page, const char *param);
195
196 static void
197 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
198
199 static void
200 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
201
202 static void
203 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
204
205 static void
206 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
207
208 static void
702868aa » DuClare
2009-05-13 Added load_finish_handler, call when a page has finished loading.
209 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
210
211 static void
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
212 destroy_cb (GtkWidget* widget, gpointer data);
213
214 static void
215 log_history_cb ();
216
217 static void
218 commands_hash(void);
219
220 void
221 free_action(gpointer act);
222
223 Action*
224 new_action(const gchar *name, const gchar *param);
225
226 static bool
227 file_exists (const char * filename);
228
229 void
230 set_insert_mode(WebKitWebView *page, const gchar *param);
231
232 static void
233 load_uri (WebKitWebView * web_view, const gchar *param);
234
235 static void
236 new_window_load_uri (const gchar * uri);
237
238 static void
239 close_uzbl (WebKitWebView *page, const char *param);
240
241 static gboolean
63a46f21 » age
2009-05-04 Something's working
242 run_command_async(const char *command, const char *args);
243
244 static gboolean
245 run_command_sync(const char *command, const char *args, char **stdout);
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
246
247 static void
248 spawn(WebKitWebView *web_view, const char *param);
249
250 static void
251 parse_command(const char *cmd, const char *param);
252
5171e781 » DuClare
2009-05-15 Add missing declaration, add runcmd for running bind, etc. via gui
253 static void
254 runcmd(WebKitWebView *page, const char *param);
255
256 static void
257 parse_cmd_line(const char *ctl_line);
258
44ec7396 » DuClare
2009-05-14 Rename create_socket to init_socket, refactor init_*
259 static gchar*
260 build_stream_name(int type, const gchar *dir);
50d7e59d » Dieterbe
2009-05-02 merge robm changes: instance naming + better socket code
261
b329cac4 » DuClare
2009-05-15 Add SET handling for useragent.
262 static gboolean
263 var_is(const char *x, const char *y);
264
265 static gchar*
266 set_useragent(gchar *val);
267
4cb5e65f » robm
2009-05-15 fixed control_fifo() to return a correct status
268 static gboolean
0536ddbc » Dieterbe
2009-05-03 somewhat improved fifo code. bug still not fixed
269 control_fifo(GIOChannel *gio, GIOCondition condition);
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
270
44ec7396 » DuClare
2009-05-14 Rename create_socket to init_socket, refactor init_*
271 static gchar*
272 init_fifo(gchar *dir);
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
273
06decd11 » robm
2009-05-12 first partially working command parser
274 static gboolean
4cd06fbc » Dieterbe
2009-05-09 support getting commands from stdin
275 control_stdin(GIOChannel *gio, GIOCondition condition);
276
277 static void
278 create_stdin();
279
44ec7396 » DuClare
2009-05-14 Rename create_socket to init_socket, refactor init_*
280 static gchar*
281 init_socket(gchar *dir);
50d7e59d » Dieterbe
2009-05-02 merge robm changes: instance naming + better socket code
282
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
283 static void
50d7e59d » Dieterbe
2009-05-02 merge robm changes: instance naming + better socket code
284 control_socket(GIOChannel *chan);
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
285
286 static void
287 update_title (void);
288
289 static gboolean
290 key_press_cb (WebKitWebView* page, GdkEventKey* event);
291
fd4821b6 » DuClare
2009-05-16 Move execution from key_press_cb to its own function, run_keycmd.
292 static void
293 run_keycmd(const gboolean key_ret);
294
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
295 static GtkWidget*
296 create_browser ();
297
298 static GtkWidget*
299 create_mainbar ();
300
301 static
302 GtkWidget* create_window ();
303
304 static void
305 add_binding (const gchar *key, const gchar *act);
306
307 static void
308 settings_init ();
309
1825c5b1 » dusanx
2009-05-03 Search
310 static void
311 search_text (WebKitWebView *page, const char *param);
312
01cfcffd » Barrucadu
2009-05-03 Added command "script" to run javascript on the current page.
313 static void
314 run_js (WebKitWebView * web_view, const gchar *param);
315
12b0591e » age
2009-05-05 Implement saving cookies
316 static void handle_cookies (SoupSession *session,
317 SoupMessage *msg,
318 gpointer user_data);
319 static void
320 save_cookies (SoupMessage *msg,
321 gpointer user_data);
8ba87ad7 » Barrucadu
2009-05-01 Moved structs/function primitives to uzbl.h file, so we no longer nee…
322 /* vi: set et ts=4: */
Something went wrong with that request. Please try again.