2 * See LICENSE for license details
7 * (c) 2009 by Robert Manea
8 * - introduced struct concept
13 #define STATUS_DEFAULT "<span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%) <b>TITLE</b> - Uzbl browser"
16 /* statusbar symbols */
17 SYM_TITLE, SYM_URI, SYM_NAME,
18 SYM_LOADPRGS, SYM_LOADPRGSBAR,
19 SYM_KEYCMD, SYM_MODE, SYM_MSG,
20 /* useragent symbols */
21 SYM_WK_MAJ, SYM_WK_MIN, SYM_WK_MIC,
22 SYM_SYSNAME, SYM_NODENAME,
23 SYM_KERNREL, SYM_KERNVER,
24 SYM_ARCHSYS, SYM_ARCHUZBL,
25 SYM_DOMAINNAME, SYM_COMMIT
35 {"KEYCMD", SYM_KEYCMD},
38 {"LOAD_PROGRESS", SYM_LOADPRGS},
39 {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR},
41 {"WEBKIT_MAJOR", SYM_WK_MAJ},
42 {"WEBKIT_MINOR", SYM_WK_MIN},
43 {"WEBKIT_MICRO", SYM_WK_MIC},
44 {"SYSNAME", SYM_SYSNAME},
45 {"NODENAME", SYM_NODENAME},
46 {"KERNREL", SYM_KERNREL},
47 {"KERNVER", SYM_KERNVER},
48 {"ARCH_SYSTEM", SYM_ARCHSYS},
49 {"ARCH_UZBL", SYM_ARCHUZBL},
50 {"DOMAINNAME", SYM_DOMAINNAME},
51 {"COMMIT", SYM_COMMIT},
55 /* status bar elements */
64 GtkWidget* main_window;
65 GtkWidget* scrolled_win;
68 GtkWidget* mainbar_label;
69 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
70 GtkScrollbar* scbar_h; // (These are still hidden)
71 GtkAdjustment* bar_v; // Information about document length
72 GtkAdjustment* bar_h; // and scrolling position
73 WebKitWebView* web_view;
80 /* external communication*/
85 /* stores (key)"variable name" -> (value)"pointer to this var*/
86 GHashTable *proto_var;
87 /* command parsing regexes */
101 gchar config_file_path[500];
102 gchar selected_url[500];
103 char executable_path[500];
106 struct utsname unameinfo; /* system info */
112 SoupSession *soup_session;
113 SoupLogger *soup_logger;
123 gchar* load_finish_handler;
124 gchar* status_format;
125 gchar* status_background;
126 gchar* history_handler;
129 gchar* download_handler;
130 gchar* cookie_handler;
131 gboolean always_insert_mode;
132 gboolean show_status;
133 gboolean insert_mode;
135 gboolean reset_command_mode;
139 guint default_font_size;
140 guint minimum_font_size;
143 /* command list: name -> Command */
144 GHashTable* commands;
148 /* main uzbl data structure */
159 /* group bindings: key -> action */
160 GHashTable* bindings;
169 typedef void sigfunc(int);
182 catch_sigterm(int s);
185 setup_signal(int signe, sigfunc *shandler);
188 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
191 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
194 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
197 toggle_status_cb (WebKitWebView* page, const char *param);
200 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
203 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
206 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
209 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
212 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
215 destroy_cb (GtkWidget* widget, gpointer data);
224 free_action(gpointer act);
227 new_action(const gchar *name, const gchar *param);
230 file_exists (const char * filename);
233 set_insert_mode(WebKitWebView *page, const gchar *param);
236 load_uri (WebKitWebView * web_view, const gchar *param);
239 new_window_load_uri (const gchar * uri);
242 close_uzbl (WebKitWebView *page, const char *param);
245 run_command(const char *command, const char *args, const gboolean sync, char **stdout);
248 spawn(WebKitWebView *web_view, const char *param);
251 spawn_sh(WebKitWebView *web_view, const char *param);
254 parse_command(const char *cmd, const char *param);
257 runcmd(WebKitWebView *page, const char *param);
260 parse_cmd_line(const char *ctl_line);
263 build_stream_name(int type, const gchar *dir);
266 var_is(const char *x, const char *y);
269 set_useragent(gchar *val);
272 control_fifo(GIOChannel *gio, GIOCondition condition);
275 init_fifo(gchar *dir);
278 control_stdin(GIOChannel *gio, GIOCondition condition);
284 init_socket(gchar *dir);
287 control_socket(GIOChannel *chan);
293 key_press_cb (WebKitWebView* page, GdkEventKey* event);
296 run_keycmd(const gboolean key_ret);
305 GtkWidget* create_window ();
308 add_binding (const gchar *key, const gchar *act);
314 search_text (WebKitWebView *page, const char *param);
317 run_js (WebKitWebView * web_view, const gchar *param);
319 static void handle_cookies (SoupSession *session,
323 save_cookies (SoupMessage *msg,
325 /* vi: set et ts=4: */