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,
26 {"KEYCMD", SYM_KEYCMD},
31 /* status bar elements */
35 gchar *progress_s, *progress_u;
38 gchar *mode_indicator;
44 GtkWidget* main_window;
47 GtkWidget* scrolled_win;
50 GtkWidget* mainbar_label;
51 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
52 GtkScrollbar* scbar_h; // (These are still hidden)
53 GtkAdjustment* bar_v; // Information about document length
54 GtkAdjustment* bar_h; // and scrolling position
55 WebKitWebView* web_view;
60 GtkWidget *inspector_window;
61 WebKitWebInspector *inspector;
67 /* external communication*/
72 /* stores (key)"variable name" -> (value)"pointer to this var*/
73 GHashTable *proto_var;
86 gchar *executable_path;
95 SoupSession *soup_session;
96 SoupLogger *soup_logger;
106 gchar* load_finish_handler;
107 gchar* load_start_handler;
108 gchar* load_commit_handler;
109 gchar* status_format;
110 gchar* title_format_short;
111 gchar* title_format_long;
112 gchar* status_background;
113 gchar* history_handler;
116 gchar* download_handler;
117 gchar* cookie_handler;
119 gboolean always_insert_mode;
120 gboolean show_status;
121 gboolean insert_mode;
123 gboolean reset_command_mode;
128 /* WebKitWebSettings exports */
130 guint monospace_size;
131 guint minimum_font_size;
133 guint disable_plugins;
134 guint disable_scripts;
136 guint autoshrink_img;
137 guint enable_spellcheck;
138 guint enable_private;
142 gchar* default_encoding;
145 guint caret_browsing;
148 gchar* html_endmarker;
149 gchar* insert_indicator;
150 gchar* cmd_indicator;
151 GString* html_buffer;
153 gboolean print_version;
155 /* command list: name -> Command */
156 GHashTable* commands;
161 gboolean initialized;
162 JSClassDefinition classdef;
166 /* static information */
175 /* main uzbl data structure */
188 /* group bindings: key -> action */
189 GHashTable* bindings;
198 typedef void sigfunc(int);
203 gchar* environmental;
204 gchar* default_value;
209 { "XDG_CONFIG_HOME", "~/.config" },
210 { "XDG_DATA_HOME", "~/.local/share" },
211 { "XDG_CACHE_HOME", "~/.cache" },
212 { "XDG_CONFIG_DIRS", "/etc/xdg" },
213 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
224 str_replace (const char* search, const char* replace, const char* string);
227 read_file_by_line (gchar *path);
230 gchar* parseenv (char* string);
236 catch_sigterm(int s);
239 setup_signal(int signe, sigfunc *shandler);
242 set_var_value(gchar *name, gchar *val);
245 print(WebKitWebView *page, GArray *argv, GString *result);
248 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
251 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
254 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
257 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
260 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
263 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
266 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
269 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
272 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
275 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
278 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
281 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
284 destroy_cb (GtkWidget* widget, gpointer data);
293 free_action(gpointer act);
296 new_action(const gchar *name, const gchar *param);
299 file_exists (const char * filename);
305 set_mode_indicator();
308 set_insert_mode(gboolean mode);
311 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
314 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
317 new_window_load_uri (const gchar * uri);
320 chain (WebKitWebView *page, GArray *argv, GString *result);
323 keycmd (WebKitWebView *page, GArray *argv, GString *result);
326 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
329 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
332 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
335 run_command(const gchar *command, const guint npre,
336 const gchar **args, const gboolean sync, char **output_stdout);
339 build_progressbar_ascii(int percent);
342 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
345 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
348 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
351 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
354 parse_command(const char *cmd, const char *param, GString *result);
357 parse_cmd_line(const char *ctl_line, GString *result);
360 build_stream_name(int type, const gchar *dir);
363 control_fifo(GIOChannel *gio, GIOCondition condition);
366 init_fifo(gchar *dir);
369 control_stdin(GIOChannel *gio, GIOCondition condition);
375 init_socket(gchar *dir);
378 control_socket(GIOChannel *chan);
381 control_client_socket(GIOChannel *chan);
387 key_press_cb (GtkWidget* window, GdkEventKey* event);
390 run_keycmd(const gboolean key_ret);
393 exec_paramcmd(const Action* act, const guint i);
405 GtkWidget* create_window ();
408 GtkPlug* create_plug ();
411 run_handler (const gchar *act, const gchar *args);
414 add_binding (const gchar *key, const gchar *act);
417 get_xdg_var (XDG_Var xdg);
420 find_xdg_file (int xdg_type, char* filename);
426 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
429 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
432 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
435 dehilight (WebKitWebView *page, GArray *argv, GString *result);
438 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
441 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
444 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
446 static void handle_cookies (SoupSession *session,
450 save_cookies (SoupMessage *msg,
454 set_var(WebKitWebView *page, GArray *argv, GString *result);
457 act_bind(WebKitWebView *page, GArray *argv, GString *result);
466 set_timeout(int seconds);
469 dump_var_hash(gpointer k, gpointer v, gpointer ud);
472 dump_key_hash(gpointer k, gpointer v, gpointer ud);
482 configure_event_cb(GtkWidget* window, GdkEventConfigure* event);
484 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
490 /* Command callbacks */
504 cmd_cookie_handler();
513 cmd_always_insert_mode();
522 cmd_max_conns_host();
524 /* exported WebKitWebSettings properties */
533 cmd_disable_plugins();
536 cmd_disable_scripts();
539 cmd_minimum_font_size();
557 cmd_autoshrink_img();
560 cmd_enable_spellcheck();
563 cmd_enable_private();
575 cmd_default_encoding();
584 cmd_caret_browsing();
589 /* vi: set et ts=4: */