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 */
100 gchar config_file_path[500];
101 gchar selected_url[500];
102 char executable_path[500];
105 struct utsname unameinfo; /* system info */
111 SoupSession *soup_session;
112 SoupLogger *soup_logger;
122 gchar* load_finish_handler;
123 gchar* status_format;
124 gchar* status_background;
125 gchar* history_handler;
128 gchar* download_handler;
129 gchar* cookie_handler;
130 gboolean always_insert_mode;
131 gboolean show_status;
132 gboolean insert_mode;
134 gboolean reset_command_mode;
139 /* command list: name -> Command */
140 GHashTable* commands;
144 /* main uzbl data structure */
155 /* group bindings: key -> action */
156 GHashTable* bindings;
165 typedef void sigfunc(int);
178 catch_sigterm(int s);
181 setup_signal(int signe, sigfunc *shandler);
184 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
187 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
190 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
193 toggle_status_cb (WebKitWebView* page, const char *param);
196 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
199 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
202 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
205 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
208 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
211 destroy_cb (GtkWidget* widget, gpointer data);
220 free_action(gpointer act);
223 new_action(const gchar *name, const gchar *param);
226 file_exists (const char * filename);
229 set_insert_mode(WebKitWebView *page, const gchar *param);
232 load_uri (WebKitWebView * web_view, const gchar *param);
235 new_window_load_uri (const gchar * uri);
238 close_uzbl (WebKitWebView *page, const char *param);
241 run_command_async(const char *command, const char *args);
244 run_command_sync(const char *command, const char *args, char **stdout);
247 spawn(WebKitWebView *web_view, const char *param);
250 parse_command(const char *cmd, const char *param);
253 runcmd(WebKitWebView *page, const char *param);
256 parse_cmd_line(const char *ctl_line);
259 build_stream_name(int type, const gchar *dir);
262 var_is(const char *x, const char *y);
265 set_useragent(gchar *val);
268 control_fifo(GIOChannel *gio, GIOCondition condition);
271 init_fifo(gchar *dir);
274 control_stdin(GIOChannel *gio, GIOCondition condition);
280 init_socket(gchar *dir);
283 control_socket(GIOChannel *chan);
289 key_press_cb (WebKitWebView* page, GdkEventKey* event);
298 GtkWidget* create_window ();
301 add_binding (const gchar *key, const gchar *act);
307 search_text (WebKitWebView *page, const char *param);
310 run_js (WebKitWebView * web_view, const gchar *param);
312 static void handle_cookies (SoupSession *session,
316 save_cookies (SoupMessage *msg,
318 /* vi: set et ts=4: */