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;
46 GtkWidget* scrolled_win;
49 GtkWidget* mainbar_label;
50 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
51 GtkScrollbar* scbar_h; // (These are still hidden)
52 GtkAdjustment* bar_v; // Information about document length
53 GtkAdjustment* bar_h; // and scrolling position
54 WebKitWebView* web_view;
59 GtkWidget *inspector_window;
60 WebKitWebInspector *inspector;
66 /* external communication*/
71 /* stores (key)"variable name" -> (value)"pointer to this var*/
72 GHashTable *proto_var;
85 gchar *executable_path;
94 SoupSession *soup_session;
95 SoupLogger *soup_logger;
105 gchar* load_finish_handler;
106 gchar* load_start_handler;
107 gchar* load_commit_handler;
108 gchar* status_format;
109 gchar* title_format_short;
110 gchar* title_format_long;
111 gchar* status_background;
112 gchar* history_handler;
115 gchar* download_handler;
116 gchar* cookie_handler;
117 gboolean always_insert_mode;
118 gboolean show_status;
119 gboolean insert_mode;
121 gboolean reset_command_mode;
126 /* WebKitWebSettings exports */
128 guint monospace_size;
129 guint minimum_font_size;
131 guint disable_plugins;
132 guint disable_scripts;
134 guint autoshrink_img;
135 guint enable_spellcheck;
136 guint enable_private;
140 gchar* default_encoding;
143 guint caret_browsing;
146 gchar* html_endmarker;
147 gchar* insert_indicator;
148 gchar* cmd_indicator;
149 GString* html_buffer;
152 /* command list: name -> Command */
153 GHashTable* commands;
158 gboolean initialized;
159 JSClassDefinition classdef;
163 /* static information */
172 /* main uzbl data structure */
185 /* group bindings: key -> action */
186 GHashTable* bindings;
195 typedef void sigfunc(int);
200 gchar* environmental;
201 gchar* default_value;
206 { "XDG_CONFIG_HOME", "~/.config" },
207 { "XDG_DATA_HOME", "~/.local/share" },
208 { "XDG_CACHE_HOME", "~/.cache" },
209 { "XDG_CONFIG_DIRS", "/etc/xdg" },
210 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
221 str_replace (const char* search, const char* replace, const char* string);
224 read_file_by_line (gchar *path);
227 gchar* parseenv (char* string);
233 catch_sigterm(int s);
236 setup_signal(int signe, sigfunc *shandler);
239 set_var_value(gchar *name, gchar *val);
242 print(WebKitWebView *page, GArray *argv, GString *result);
245 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
248 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
251 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
254 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
257 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
260 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
263 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
266 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
269 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
272 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
275 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
278 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
281 destroy_cb (GtkWidget* widget, gpointer data);
290 free_action(gpointer act);
293 new_action(const gchar *name, const gchar *param);
296 file_exists (const char * filename);
299 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
302 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
305 new_window_load_uri (const gchar * uri);
308 chain (WebKitWebView *page, GArray *argv, GString *result);
311 keycmd (WebKitWebView *page, GArray *argv, GString *result);
314 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
317 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
320 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
323 run_command(const gchar *command, const guint npre,
324 const gchar **args, const gboolean sync, char **output_stdout);
327 build_progressbar_ascii(int percent);
330 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
333 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
336 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
339 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
342 parse_command(const char *cmd, const char *param, GString *result);
345 parse_cmd_line(const char *ctl_line, GString *result);
348 build_stream_name(int type, const gchar *dir);
351 control_fifo(GIOChannel *gio, GIOCondition condition);
354 init_fifo(gchar *dir);
357 control_stdin(GIOChannel *gio, GIOCondition condition);
363 init_socket(gchar *dir);
366 control_socket(GIOChannel *chan);
369 control_client_socket(GIOChannel *chan);
375 key_press_cb (GtkWidget* window, GdkEventKey* event);
378 run_keycmd(const gboolean key_ret);
381 exec_paramcmd(const Action* act, const guint i);
393 GtkWidget* create_window ();
396 GtkPlug* create_plug ();
399 run_handler (const gchar *act, const gchar *args);
402 add_binding (const gchar *key, const gchar *act);
405 get_xdg_var (XDG_Var xdg);
408 find_xdg_file (int xdg_type, char* filename);
414 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
417 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
420 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
423 dehilight (WebKitWebView *page, GArray *argv, GString *result);
426 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
429 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
432 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
434 static void handle_cookies (SoupSession *session,
438 save_cookies (SoupMessage *msg,
442 set_var(WebKitWebView *page, GArray *argv, GString *result);
445 act_bind(WebKitWebView *page, GArray *argv, GString *result);
454 set_timeout(int seconds);
457 dump_var_hash(gpointer k, gpointer v, gpointer ud);
460 dump_key_hash(gpointer k, gpointer v, gpointer ud);
466 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
472 /* Command callbacks */
486 cmd_cookie_handler();
492 cmd_always_insert_mode();
501 cmd_max_conns_host();
503 /* exported WebKitWebSettings properties */
512 cmd_disable_plugins();
515 cmd_disable_scripts();
518 cmd_minimum_font_size();
536 cmd_autoshrink_img();
539 cmd_enable_spellcheck();
542 cmd_enable_private();
554 cmd_default_encoding();
563 cmd_caret_browsing();
565 /* vi: set et ts=4: */