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;
51 GtkWidget* main_window;
53 GtkWidget* scrolled_win;
56 GtkWidget* mainbar_label;
57 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
58 GtkScrollbar* scbar_h; // (These are still hidden)
59 GtkAdjustment* bar_v; // Information about document length
60 GtkAdjustment* bar_h; // and scrolling position
61 WebKitWebView* web_view;
66 GtkWidget *inspector_window;
67 WebKitWebInspector *inspector;
73 /* external communication*/
78 /* stores (key)"variable name" -> (value)"pointer to this var*/
79 GHashTable *proto_var;
92 gchar *executable_path;
101 SoupSession *soup_session;
102 SoupLogger *soup_logger;
112 gchar* load_finish_handler;
113 gchar* load_start_handler;
114 gchar* load_commit_handler;
115 gchar* status_format;
116 gchar* title_format_short;
117 gchar* title_format_long;
118 gchar* status_background;
119 gchar* history_handler;
122 gchar* download_handler;
123 gchar* cookie_handler;
124 gboolean always_insert_mode;
125 gboolean show_status;
126 gboolean insert_mode;
128 gboolean reset_command_mode;
133 /* WebKitWebSettings exports */
135 guint monospace_size;
136 guint minimum_font_size;
138 guint disable_plugins;
139 guint disable_scripts;
141 guint autoshrink_img;
142 guint enable_spellcheck;
143 guint enable_private;
147 gchar* default_encoding;
150 guint caret_browsing;
153 gchar* html_endmarker;
154 gchar* insert_indicator;
155 gchar* cmd_indicator;
156 GString* html_buffer;
159 /* command list: name -> Command */
160 GHashTable* commands;
165 gboolean initialized;
166 JSClassDefinition classdef;
170 /* static information */
179 /* main uzbl data structure */
192 /* group bindings: key -> action */
193 GHashTable* bindings;
202 typedef void sigfunc(int);
207 gchar* environmental;
208 gchar* default_value;
213 { "XDG_CONFIG_HOME", "~/.config" },
214 { "XDG_DATA_HOME", "~/.local/share" },
215 { "XDG_CACHE_HOME", "~/.cache" },
216 { "XDG_CONFIG_DIRS", "/etc/xdg" },
217 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
228 str_replace (const char* search, const char* replace, const char* string);
231 read_file_by_line (gchar *path);
234 gchar* parseenv (char* string);
240 catch_sigterm(int s);
243 setup_signal(int signe, sigfunc *shandler);
246 set_var_value(gchar *name, gchar *val);
249 print(WebKitWebView *page, GArray *argv, GString *result);
252 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
255 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
258 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
261 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
264 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
267 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
270 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
273 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
276 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
279 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
282 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
285 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
288 destroy_cb (GtkWidget* widget, gpointer data);
297 free_action(gpointer act);
300 new_action(const gchar *name, const gchar *param);
303 file_exists (const char * filename);
306 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
309 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
312 new_window_load_uri (const gchar * uri);
315 chain (WebKitWebView *page, GArray *argv, GString *result);
318 keycmd (WebKitWebView *page, GArray *argv, GString *result);
321 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
324 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
327 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
330 run_command(const gchar *command, const guint npre,
331 const gchar **args, const gboolean sync, char **output_stdout);
334 build_progressbar_ascii(int percent);
337 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
340 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
343 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
346 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
349 parse_command(const char *cmd, const char *param, GString *result);
352 parse_cmd_line(const char *ctl_line, GString *result);
355 build_stream_name(int type, const gchar *dir);
358 control_fifo(GIOChannel *gio, GIOCondition condition);
361 init_fifo(gchar *dir);
364 control_stdin(GIOChannel *gio, GIOCondition condition);
370 init_socket(gchar *dir);
373 control_socket(GIOChannel *chan);
376 control_client_socket(GIOChannel *chan);
382 key_press_cb (GtkWidget* window, GdkEventKey* event);
385 run_keycmd(const gboolean key_ret);
388 exec_paramcmd(const Action* act, const guint i);
400 GtkWidget* create_window ();
403 GtkPlug* create_plug ();
406 run_handler (const gchar *act, const gchar *args);
409 add_binding (const gchar *key, const gchar *act);
412 get_xdg_var (XDG_Var xdg);
415 find_xdg_file (int xdg_type, char* filename);
421 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
424 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
427 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
430 dehilight (WebKitWebView *page, GArray *argv, GString *result);
433 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
436 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
439 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
441 static void handle_cookies (SoupSession *session,
445 save_cookies (SoupMessage *msg,
449 set_var(WebKitWebView *page, GArray *argv, GString *result);
452 act_bind(WebKitWebView *page, GArray *argv, GString *result);
461 set_timeout(int seconds);
464 dump_var_hash(gpointer k, gpointer v, gpointer ud);
467 dump_key_hash(gpointer k, gpointer v, gpointer ud);
473 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
479 /* Command callbacks */
493 cmd_cookie_handler();
499 cmd_always_insert_mode();
508 cmd_max_conns_host();
510 /* exported WebKitWebSettings properties */
519 cmd_disable_plugins();
522 cmd_disable_scripts();
525 cmd_minimum_font_size();
543 cmd_autoshrink_img();
546 cmd_enable_spellcheck();
549 cmd_enable_private();
561 cmd_default_encoding();
570 cmd_caret_browsing();
572 /* vi: set et ts=4: */