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;
140 /* command list: name -> Command */
141 GHashTable* commands;
145 /* main uzbl data structure */
156 /* group bindings: key -> action */
157 GHashTable* bindings;
166 typedef void sigfunc(int);
179 catch_sigterm(int s);
182 setup_signal(int signe, sigfunc *shandler);
185 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
188 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
191 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
194 toggle_status_cb (WebKitWebView* page, const char *param);
197 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
200 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
203 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
206 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
209 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
212 destroy_cb (GtkWidget* widget, gpointer data);
221 free_action(gpointer act);
224 new_action(const gchar *name, const gchar *param);
227 file_exists (const char * filename);
230 set_insert_mode(WebKitWebView *page, const gchar *param);
233 load_uri (WebKitWebView * web_view, const gchar *param);
236 new_window_load_uri (const gchar * uri);
239 close_uzbl (WebKitWebView *page, const char *param);
242 run_command(const char *command, const char *args, const gboolean sync, char **stdout);
245 spawn(WebKitWebView *web_view, const char *param);
248 parse_command(const char *cmd, const char *param);
251 runcmd(WebKitWebView *page, const char *param);
254 parse_cmd_line(const char *ctl_line);
257 build_stream_name(int type, const gchar *dir);
260 var_is(const char *x, const char *y);
263 set_useragent(gchar *val);
266 control_fifo(GIOChannel *gio, GIOCondition condition);
269 init_fifo(gchar *dir);
272 control_stdin(GIOChannel *gio, GIOCondition condition);
278 init_socket(gchar *dir);
281 control_socket(GIOChannel *chan);
287 key_press_cb (WebKitWebView* page, GdkEventKey* event);
290 run_keycmd(const gboolean key_ret);
299 GtkWidget* create_window ();
302 add_binding (const gchar *key, const gchar *act);
308 search_text (WebKitWebView *page, const char *param);
311 run_js (WebKitWebView * web_view, const gchar *param);
313 static void handle_cookies (SoupSession *session,
317 save_cookies (SoupMessage *msg,
319 /* vi: set et ts=4: */