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;
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;
152 gboolean print_version;
154 /* command list: name -> Command */
155 GHashTable* commands;
160 gboolean initialized;
161 JSClassDefinition classdef;
165 /* static information */
174 /* main uzbl data structure */
187 /* group bindings: key -> action */
188 GHashTable* bindings;
197 typedef void sigfunc(int);
202 gchar* environmental;
203 gchar* default_value;
208 { "XDG_CONFIG_HOME", "~/.config" },
209 { "XDG_DATA_HOME", "~/.local/share" },
210 { "XDG_CACHE_HOME", "~/.cache" },
211 { "XDG_CONFIG_DIRS", "/etc/xdg" },
212 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
223 str_replace (const char* search, const char* replace, const char* string);
226 read_file_by_line (gchar *path);
229 gchar* parseenv (char* string);
235 catch_sigterm(int s);
238 setup_signal(int signe, sigfunc *shandler);
241 set_var_value(gchar *name, gchar *val);
244 print(WebKitWebView *page, GArray *argv, GString *result);
247 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
250 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
253 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
256 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
259 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
262 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
265 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
268 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
271 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
274 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
277 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
280 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
283 destroy_cb (GtkWidget* widget, gpointer data);
292 free_action(gpointer act);
295 new_action(const gchar *name, const gchar *param);
298 file_exists (const char * filename);
300 void set_insert_mode(gboolean mode);
303 toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result);
306 load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
309 new_window_load_uri (const gchar * uri);
312 chain (WebKitWebView *page, GArray *argv, GString *result);
315 keycmd (WebKitWebView *page, GArray *argv, GString *result);
318 keycmd_nl (WebKitWebView *page, GArray *argv, GString *result);
321 keycmd_bs (WebKitWebView *page, GArray *argv, GString *result);
324 close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
327 run_command(const gchar *command, const guint npre,
328 const gchar **args, const gboolean sync, char **output_stdout);
331 build_progressbar_ascii(int percent);
334 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
337 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
340 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
343 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
346 parse_command(const char *cmd, const char *param, GString *result);
349 parse_cmd_line(const char *ctl_line, GString *result);
352 build_stream_name(int type, const gchar *dir);
355 control_fifo(GIOChannel *gio, GIOCondition condition);
358 init_fifo(gchar *dir);
361 control_stdin(GIOChannel *gio, GIOCondition condition);
367 init_socket(gchar *dir);
370 control_socket(GIOChannel *chan);
373 control_client_socket(GIOChannel *chan);
379 key_press_cb (GtkWidget* window, GdkEventKey* event);
382 run_keycmd(const gboolean key_ret);
385 exec_paramcmd(const Action* act, const guint i);
397 GtkWidget* create_window ();
400 GtkPlug* create_plug ();
403 run_handler (const gchar *act, const gchar *args);
406 add_binding (const gchar *key, const gchar *act);
409 get_xdg_var (XDG_Var xdg);
412 find_xdg_file (int xdg_type, char* filename);
418 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
421 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
424 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
427 dehilight (WebKitWebView *page, GArray *argv, GString *result);
430 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
433 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
436 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
438 static void handle_cookies (SoupSession *session,
442 save_cookies (SoupMessage *msg,
446 set_var(WebKitWebView *page, GArray *argv, GString *result);
449 act_bind(WebKitWebView *page, GArray *argv, GString *result);
458 set_timeout(int seconds);
461 dump_var_hash(gpointer k, gpointer v, gpointer ud);
464 dump_key_hash(gpointer k, gpointer v, gpointer ud);
470 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
476 /* Command callbacks */
490 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: */