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;
91 gchar *executable_path;
100 SoupSession *soup_session;
101 SoupLogger *soup_logger;
111 gchar* load_finish_handler;
112 gchar* load_start_handler;
113 gchar* load_commit_handler;
114 gchar* status_format;
115 gchar* title_format_short;
116 gchar* title_format_long;
117 gchar* status_background;
118 gchar* history_handler;
121 gchar* download_handler;
122 gchar* cookie_handler;
123 gboolean always_insert_mode;
124 gboolean show_status;
125 gboolean insert_mode;
127 gboolean reset_command_mode;
132 /* WebKitWebSettings exports */
134 guint monospace_size;
135 guint minimum_font_size;
137 guint disable_plugins;
138 guint disable_scripts;
140 guint autoshrink_img;
141 guint enable_spellcheck;
142 guint enable_private;
146 gchar* default_encoding;
149 guint caret_browsing;
152 gchar* html_endmarker;
153 gchar* insert_indicator;
154 gchar* cmd_indicator;
155 GString* html_buffer;
158 /* command list: name -> Command */
159 GHashTable* commands;
164 gboolean initialized;
165 JSClassDefinition classdef;
169 /* static information */
178 /* main uzbl data structure */
191 /* group bindings: key -> action */
192 GHashTable* bindings;
201 typedef void sigfunc(int);
206 gchar* environmental;
207 gchar* default_value;
212 { "XDG_CONFIG_HOME", "~/.config" },
213 { "XDG_DATA_HOME", "~/.local/share" },
214 { "XDG_CACHE_HOME", "~/.cache" },
215 { "XDG_CONFIG_DIRS", "/etc/xdg" },
216 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
227 str_replace (const char* search, const char* replace, const char* string);
230 read_file_by_line (gchar *path);
233 gchar* parseenv (char* string);
239 catch_sigterm(int s);
242 setup_signal(int signe, sigfunc *shandler);
245 set_var_value(gchar *name, gchar *val);
248 print(WebKitWebView *page, GArray *argv, GString *result);
251 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
254 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
257 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
260 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
263 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
266 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
269 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
272 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
275 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
278 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
281 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
284 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
287 destroy_cb (GtkWidget* widget, gpointer data);
296 free_action(gpointer act);
299 new_action(const gchar *name, const gchar *param);
302 file_exists (const char * filename);
305 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
308 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
311 new_window_load_uri (const gchar * uri);
314 chain (WebKitWebView *page, GArray *argv, GString *result);
317 keycmd (WebKitWebView *page, GArray *argv, GString *result);
320 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
323 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
326 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
329 run_command(const gchar *command, const guint npre,
330 const gchar **args, const gboolean sync, char **output_stdout);
333 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
336 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
339 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
342 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
345 parse_command(const char *cmd, const char *param, GString *result);
348 parse_cmd_line(const char *ctl_line, GString *result);
351 build_stream_name(int type, const gchar *dir);
354 control_fifo(GIOChannel *gio, GIOCondition condition);
357 init_fifo(gchar *dir);
360 control_stdin(GIOChannel *gio, GIOCondition condition);
366 init_socket(gchar *dir);
369 control_socket(GIOChannel *chan);
372 control_client_socket(GIOChannel *chan);
378 key_press_cb (GtkWidget* window, GdkEventKey* event);
381 run_keycmd(const gboolean key_ret);
384 exec_paramcmd(const Action* act, const guint i);
396 GtkWidget* create_window ();
399 GtkPlug* create_plug ();
402 run_handler (const gchar *act, const gchar *args);
405 add_binding (const gchar *key, const gchar *act);
408 get_xdg_var (XDG_Var xdg);
411 find_xdg_file (int xdg_type, char* filename);
417 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
420 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
423 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
426 dehilight (WebKitWebView *page, GArray *argv, GString *result);
429 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
432 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
435 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
437 static void handle_cookies (SoupSession *session,
441 save_cookies (SoupMessage *msg,
445 set_var(WebKitWebView *page, GArray *argv, GString *result);
448 act_bind(WebKitWebView *page, GArray *argv, GString *result);
457 set_timeout(int seconds);
460 dump_var_hash(gpointer k, gpointer v, gpointer ud);
463 dump_key_hash(gpointer k, gpointer v, gpointer ud);
469 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
475 /* Command callbacks */
489 cmd_cookie_handler();
495 cmd_always_insert_mode();
504 cmd_max_conns_host();
506 /* exported WebKitWebSettings properties */
515 cmd_disable_plugins();
518 cmd_disable_scripts();
521 cmd_minimum_font_size();
539 cmd_autoshrink_img();
542 cmd_enable_spellcheck();
545 cmd_enable_private();
557 cmd_default_encoding();
566 cmd_caret_browsing();
568 /* vi: set et ts=4: */