1 /* -*- c-basic-offset: 4; -*-
3 * See LICENSE for license details
8 * (c) 2009 by Robert Manea
9 * - introduced struct concept
10 * - statusbar template
15 /* statusbar symbols */
16 SYM_TITLE, SYM_URI, SYM_NAME,
17 SYM_LOADPRGS, SYM_LOADPRGSBAR,
18 SYM_KEYCMD, SYM_MODE, SYM_MSG,
29 {"SELECTED_URI", SYM_SELECTED_URI},
30 {"KEYCMD", SYM_KEYCMD},
33 {"LOAD_PROGRESS", SYM_LOADPRGS},
34 {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR},
39 /* status bar elements */
43 gchar *progress_s, *progress_u;
50 GtkWidget* main_window;
52 GtkWidget* scrolled_win;
55 GtkWidget* mainbar_label;
56 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
57 GtkScrollbar* scbar_h; // (These are still hidden)
58 GtkAdjustment* bar_v; // Information about document length
59 GtkAdjustment* bar_h; // and scrolling position
60 WebKitWebView* web_view;
65 GtkWidget *inspector_window;
66 WebKitWebInspector *inspector;
72 /* external communication*/
77 /* stores (key)"variable name" -> (value)"pointer to this var*/
78 GHashTable *proto_var;
79 /* stores (key)"CONSTANT NAME" -> (value)"pointer to this var*/
80 GHashTable *proto_const;
93 gchar *executable_path;
96 struct utsname unameinfo; /* system info */
103 SoupSession *soup_session;
104 SoupLogger *soup_logger;
114 gchar* load_finish_handler;
115 gchar* load_start_handler;
116 gchar* load_commit_handler;
117 gchar* status_format;
118 gchar* title_format_short;
119 gchar* title_format_long;
120 gchar* status_background;
121 gchar* history_handler;
124 gchar* download_handler;
125 gchar* cookie_handler;
126 gboolean always_insert_mode;
127 gboolean show_status;
128 gboolean insert_mode;
130 gboolean reset_command_mode;
135 /* WebKitWebSettings exports */
137 guint monospace_size;
138 guint minimum_font_size;
140 guint disable_plugins;
141 guint disable_scripts;
143 guint autoshrink_img;
144 guint enable_spellcheck;
145 guint enable_private;
149 gchar* default_encoding;
152 guint caret_browsing;
155 gchar* html_endmarker;
156 gchar* insert_indicator;
157 gchar* cmd_indicator;
158 GString* html_buffer;
161 /* command list: name -> Command */
162 GHashTable* commands;
167 gboolean initialized;
168 JSClassDefinition classdef;
172 /* main uzbl data structure */
184 /* group bindings: key -> action */
185 GHashTable* bindings;
194 typedef void sigfunc(int);
199 gchar* environmental;
200 gchar* default_value;
205 { "XDG_CONFIG_HOME", "~/.config" },
206 { "XDG_DATA_HOME", "~/.local/share" },
207 { "XDG_CACHE_HOME", "~/.cache" },
208 { "XDG_CONFIG_DIRS", "/etc/xdg" },
209 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
220 str_replace (const char* search, const char* replace, const char* string);
223 read_file_by_line (gchar *path);
226 gchar* parseenv (char* string);
232 catch_sigterm(int s);
235 setup_signal(int signe, sigfunc *shandler);
238 set_var_value(gchar *name, gchar *val);
241 print(WebKitWebView *page, GArray *argv, GString *result);
244 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
247 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
250 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
253 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
256 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
259 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
262 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
265 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
268 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
271 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
274 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
277 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
280 destroy_cb (GtkWidget* widget, gpointer data);
289 free_action(gpointer act);
292 new_action(const gchar *name, const gchar *param);
295 file_exists (const char * filename);
298 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
301 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
304 new_window_load_uri (const gchar * uri);
307 chain (WebKitWebView *page, GArray *argv, GString *result);
310 keycmd (WebKitWebView *page, GArray *argv, GString *result);
313 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
316 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
319 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
322 run_command(const gchar *command, const guint npre,
323 const gchar **args, const gboolean sync, char **output_stdout);
326 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
329 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
332 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
335 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
338 parse_command(const char *cmd, const char *param, GString *result);
341 parse_cmd_line(const char *ctl_line, GString *result);
344 build_stream_name(int type, const gchar *dir);
347 control_fifo(GIOChannel *gio, GIOCondition condition);
350 init_fifo(gchar *dir);
353 control_stdin(GIOChannel *gio, GIOCondition condition);
359 init_socket(gchar *dir);
362 control_socket(GIOChannel *chan);
365 control_client_socket(GIOChannel *chan);
371 key_press_cb (GtkWidget* window, GdkEventKey* event);
374 run_keycmd(const gboolean key_ret);
377 exec_paramcmd(const Action* act, const guint i);
386 GtkWidget* create_window ();
389 GtkPlug* create_plug ();
392 run_handler (const gchar *act, const gchar *args);
395 add_binding (const gchar *key, const gchar *act);
398 get_xdg_var (XDG_Var xdg);
401 find_xdg_file (int xdg_type, char* filename);
407 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
410 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
413 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
416 dehilight (WebKitWebView *page, GArray *argv, GString *result);
419 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
422 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
425 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
427 static void handle_cookies (SoupSession *session,
431 save_cookies (SoupMessage *msg,
435 set_var(WebKitWebView *page, GArray *argv, GString *result);
438 act_bind(WebKitWebView *page, GArray *argv, GString *result);
447 set_timeout(int seconds);
450 dump_var_hash(gpointer k, gpointer v, gpointer ud);
453 dump_key_hash(gpointer k, gpointer v, gpointer ud);
459 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
465 /* Command callbacks */
479 cmd_cookie_handler();
485 cmd_always_insert_mode();
494 cmd_max_conns_host();
496 /* exported WebKitWebSettings properties */
505 cmd_disable_plugins();
508 cmd_disable_scripts();
511 cmd_minimum_font_size();
529 cmd_autoshrink_img();
532 cmd_enable_spellcheck();
535 cmd_enable_private();
547 cmd_default_encoding();
556 cmd_caret_browsing();
558 /* vi: set et ts=4: */