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},
32 /* status bar elements */
36 gchar *progress_s, *progress_u;
39 gchar *mode_indicator;
45 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;
118 gboolean always_insert_mode;
119 gboolean show_status;
120 gboolean insert_mode;
122 gboolean reset_command_mode;
127 /* WebKitWebSettings exports */
129 guint monospace_size;
130 guint minimum_font_size;
132 guint disable_plugins;
133 guint disable_scripts;
135 guint autoshrink_img;
136 guint enable_spellcheck;
137 guint enable_private;
141 gchar* default_encoding;
144 guint caret_browsing;
147 gchar* html_endmarker;
148 gchar* insert_indicator;
149 gchar* cmd_indicator;
150 GString* html_buffer;
153 /* command list: name -> Command */
154 GHashTable* commands;
159 gboolean initialized;
160 JSClassDefinition classdef;
164 /* static information */
173 /* main uzbl data structure */
186 /* group bindings: key -> action */
187 GHashTable* bindings;
196 typedef void sigfunc(int);
201 gchar* environmental;
202 gchar* default_value;
207 { "XDG_CONFIG_HOME", "~/.config" },
208 { "XDG_DATA_HOME", "~/.local/share" },
209 { "XDG_CACHE_HOME", "~/.cache" },
210 { "XDG_CONFIG_DIRS", "/etc/xdg" },
211 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
222 str_replace (const char* search, const char* replace, const char* string);
225 read_file_by_line (gchar *path);
228 gchar* parseenv (char* string);
234 catch_sigterm(int s);
237 setup_signal(int signe, sigfunc *shandler);
240 set_var_value(gchar *name, gchar *val);
243 print(WebKitWebView *page, GArray *argv, GString *result);
246 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
249 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
252 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
255 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
258 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
261 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
264 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
267 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
270 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
273 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
276 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
279 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
282 destroy_cb (GtkWidget* widget, gpointer data);
291 free_action(gpointer act);
294 new_action(const gchar *name, const gchar *param);
297 file_exists (const char * filename);
300 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
303 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
306 new_window_load_uri (const gchar * uri);
309 chain (WebKitWebView *page, GArray *argv, GString *result);
312 keycmd (WebKitWebView *page, GArray *argv, GString *result);
315 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
318 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
321 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
324 run_command(const gchar *command, const guint npre,
325 const gchar **args, const gboolean sync, char **output_stdout);
328 build_progressbar_ascii(int percent);
331 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
334 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
337 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
340 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
343 parse_command(const char *cmd, const char *param, GString *result);
346 parse_cmd_line(const char *ctl_line, GString *result);
349 build_stream_name(int type, const gchar *dir);
352 control_fifo(GIOChannel *gio, GIOCondition condition);
355 init_fifo(gchar *dir);
358 control_stdin(GIOChannel *gio, GIOCondition condition);
364 init_socket(gchar *dir);
367 control_socket(GIOChannel *chan);
370 control_client_socket(GIOChannel *chan);
376 key_press_cb (GtkWidget* window, GdkEventKey* event);
379 run_keycmd(const gboolean key_ret);
382 exec_paramcmd(const Action* act, const guint i);
394 GtkWidget* create_window ();
397 GtkPlug* create_plug ();
400 run_handler (const gchar *act, const gchar *args);
403 add_binding (const gchar *key, const gchar *act);
406 get_xdg_var (XDG_Var xdg);
409 find_xdg_file (int xdg_type, char* filename);
415 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
418 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
421 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
424 dehilight (WebKitWebView *page, GArray *argv, GString *result);
427 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
430 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
433 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
435 static void handle_cookies (SoupSession *session,
439 save_cookies (SoupMessage *msg,
443 set_var(WebKitWebView *page, GArray *argv, GString *result);
446 act_bind(WebKitWebView *page, GArray *argv, GString *result);
455 set_timeout(int seconds);
458 dump_var_hash(gpointer k, gpointer v, gpointer ud);
461 dump_key_hash(gpointer k, gpointer v, gpointer ud);
467 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
473 /* Command callbacks */
487 cmd_cookie_handler();
493 cmd_always_insert_mode();
502 cmd_max_conns_host();
504 /* exported WebKitWebSettings properties */
513 cmd_disable_plugins();
516 cmd_disable_scripts();
519 cmd_minimum_font_size();
537 cmd_autoshrink_img();
540 cmd_enable_spellcheck();
543 cmd_enable_private();
555 cmd_default_encoding();
564 cmd_caret_browsing();
566 /* vi: set et ts=4: */