1 /* -*- c-basic-offset: 4; -*-
3 * See LICENSE for license details
8 * (c) 2009 by Robert Manea
9 * - introduced struct concept
10 * - statusbar template
14 /* status bar elements */
18 gchar *progress_s, *progress_u;
21 gchar *mode_indicator;
27 GtkWidget* main_window;
30 GtkWidget* scrolled_win;
33 GtkWidget* mainbar_label;
34 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
35 GtkScrollbar* scbar_h; // (These are still hidden)
36 GtkAdjustment* bar_v; // Information about document length
37 GtkAdjustment* bar_h; // and scrolling position
38 WebKitWebView* web_view;
43 GtkWidget *inspector_window;
44 WebKitWebInspector *inspector;
50 /* external communication*/
55 /* stores (key)"variable name" -> (value)"pointer to this var*/
56 GHashTable *proto_var;
69 gchar *executable_path;
78 SoupSession *soup_session;
79 SoupLogger *soup_logger;
89 gchar* load_finish_handler;
90 gchar* load_start_handler;
91 gchar* load_commit_handler;
93 gchar* title_format_short;
94 gchar* title_format_long;
95 gchar* status_background;
96 gchar* history_handler;
99 gchar* download_handler;
100 gchar* cookie_handler;
102 gchar* default_font_family;
103 gchar* monospace_font_family;
104 gchar* sans_serif_font_family;
105 gchar* serif_font_family;
106 gchar* fantasy_font_family;
107 gchar* cursive_font_family;
108 gboolean always_insert_mode;
109 gboolean show_status;
110 gboolean insert_mode;
112 gboolean reset_command_mode;
117 /* WebKitWebSettings exports */
119 guint monospace_size;
120 guint minimum_font_size;
122 guint disable_plugins;
123 guint disable_scripts;
125 guint autoshrink_img;
126 guint enable_spellcheck;
127 guint enable_private;
131 gchar* default_encoding;
134 guint caret_browsing;
137 gchar* html_endmarker;
138 gchar* insert_indicator;
139 gchar* cmd_indicator;
140 GString* html_buffer;
142 gboolean print_version;
144 /* command list: name -> Command */
145 GHashTable* commands;
150 gboolean initialized;
151 JSClassDefinition classdef;
155 /* static information */
164 /* main uzbl data structure */
176 /* group bindings: key -> action */
177 GHashTable* bindings;
186 typedef void sigfunc(int);
191 gchar* environmental;
192 gchar* default_value;
197 { "XDG_CONFIG_HOME", "~/.config" },
198 { "XDG_DATA_HOME", "~/.local/share" },
199 { "XDG_CACHE_HOME", "~/.cache" },
200 { "XDG_CONFIG_DIRS", "/etc/xdg" },
201 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
209 str_replace (const char* search, const char* replace, const char* string);
212 read_file_by_line (const gchar *path);
215 parseenv (char* string);
221 catch_sigterm(int s);
224 setup_signal(int signe, sigfunc *shandler);
227 set_var_value(const gchar *name, gchar *val);
230 print(WebKitWebView *page, GArray *argv, GString *result);
233 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
236 mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
238 /*@null@*/ WebKitWebView*
239 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
242 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
245 toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result);
248 toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result);
251 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
254 title_change_cb (WebKitWebView* web_view, GParamSpec param_spec);
257 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
260 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
263 load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
266 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
269 destroy_cb (GtkWidget* widget, gpointer data);
278 free_action(gpointer act);
281 new_action(const gchar *name, const gchar *param);
284 file_exists (const char * filename);
290 set_mode_indicator();
296 set_insert_mode(gboolean mode);
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 talk_to_socket(WebKitWebView *web_view, GArray *argv, GString *result);
333 spawn(WebKitWebView *web_view, GArray *argv, GString *result);
336 spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result);
339 spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
342 spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
345 parse_command(const char *cmd, const char *param, GString *result);
348 parse_cmd_line(const char *ctl_line, GString *result);
351 build_stream_name(int type, const gchar *dir);
354 control_fifo(GIOChannel *gio, GIOCondition condition);
357 init_fifo(gchar *dir);
360 control_stdin(GIOChannel *gio, GIOCondition condition);
366 init_socket(gchar *dir);
369 control_socket(GIOChannel *chan);
372 control_client_socket(GIOChannel *chan);
378 key_press_cb (GtkWidget* window, GdkEventKey* event);
381 run_keycmd(const gboolean key_ret);
384 exec_paramcmd(const Action* act, const guint i);
387 initialize (int argc, char *argv[]);
402 run_handler (const gchar *act, const gchar *args);
405 add_binding (const gchar *key, const gchar *act);
408 get_xdg_var (XDG_Var xdg);
411 find_xdg_file (int xdg_type, const char* filename);
417 search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
420 search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
423 search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
426 dehilight (WebKitWebView *page, GArray *argv, GString *result);
429 run_js (WebKitWebView * web_view, GArray *argv, GString *result);
432 run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
435 eval_js(WebKitWebView * web_view, gchar *script, GString *result);
437 void handle_cookies (SoupSession *session,
441 save_cookies (SoupMessage *msg,
445 set_var(WebKitWebView *page, GArray *argv, GString *result);
448 act_bind(WebKitWebView *page, GArray *argv, GString *result);
457 set_timeout(int seconds);
460 dump_var_hash(gpointer k, gpointer v, gpointer ud);
463 dump_key_hash(gpointer k, gpointer v, gpointer ud);
472 update_gui(WebKitWebView *page, GArray *argv, GString *result);
475 configure_event_cb(GtkWidget* window, GdkEventConfigure* event);
477 typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
483 /* Command callbacks */
497 cmd_cookie_handler();
506 cmd_always_insert_mode();
515 cmd_max_conns_host();
517 /* exported WebKitWebSettings properties */
523 cmd_default_font_family();
526 cmd_monospace_font_family();
529 cmd_sans_serif_font_family();
532 cmd_serif_font_family();
535 cmd_cursive_font_family();
538 cmd_fantasy_font_family();
544 cmd_disable_plugins();
547 cmd_disable_scripts();
550 cmd_minimum_font_size();
568 cmd_autoshrink_img();
571 cmd_enable_spellcheck();
574 cmd_enable_private();
586 cmd_default_encoding();
595 cmd_caret_browsing();
600 /* vi: set et ts=4: */