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 #define STATUS_DEFAULT "<span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%) <b>TITLE</b> - Uzbl browser"
17 /* statusbar symbols */
18 SYM_TITLE, SYM_URI, SYM_NAME,
19 SYM_LOADPRGS, SYM_LOADPRGSBAR,
20 SYM_KEYCMD, SYM_MODE, SYM_MSG,
21 /* useragent symbols */
22 SYM_WK_MAJ, SYM_WK_MIN, SYM_WK_MIC,
23 SYM_SYSNAME, SYM_NODENAME,
24 SYM_KERNREL, SYM_KERNVER,
25 SYM_ARCHSYS, SYM_ARCHUZBL,
26 SYM_DOMAINNAME, SYM_COMMIT
36 {"KEYCMD", SYM_KEYCMD},
39 {"LOAD_PROGRESS", SYM_LOADPRGS},
40 {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR},
42 {"WEBKIT_MAJOR", SYM_WK_MAJ},
43 {"WEBKIT_MINOR", SYM_WK_MIN},
44 {"WEBKIT_MICRO", SYM_WK_MIC},
45 {"SYSNAME", SYM_SYSNAME},
46 {"NODENAME", SYM_NODENAME},
47 {"KERNREL", SYM_KERNREL},
48 {"KERNVER", SYM_KERNVER},
49 {"ARCH_SYSTEM", SYM_ARCHSYS},
50 {"ARCH_UZBL", SYM_ARCHUZBL},
51 {"DOMAINNAME", SYM_DOMAINNAME},
52 {"COMMIT", SYM_COMMIT},
56 /* status bar elements */
65 GtkWidget* main_window;
66 GtkWidget* scrolled_win;
69 GtkWidget* mainbar_label;
70 GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
71 GtkScrollbar* scbar_h; // (These are still hidden)
72 GtkAdjustment* bar_v; // Information about document length
73 GtkAdjustment* bar_h; // and scrolling position
74 WebKitWebView* web_view;
81 /* external communication*/
86 /* stores (key)"variable name" -> (value)"pointer to this var*/
87 GHashTable *proto_var;
88 /* command parsing regexes */
102 gchar config_file_path[500];
103 gchar selected_url[500];
104 char executable_path[500];
107 struct utsname unameinfo; /* system info */
114 SoupSession *soup_session;
115 SoupLogger *soup_logger;
125 gchar* load_finish_handler;
126 gchar* status_format;
127 gchar* status_background;
128 gchar* history_handler;
131 gchar* download_handler;
132 gchar* cookie_handler;
133 gboolean always_insert_mode;
134 gboolean show_status;
135 gboolean insert_mode;
137 gboolean reset_command_mode;
141 guint default_font_size;
142 guint minimum_font_size;
145 /* command list: name -> Command */
146 GHashTable* commands;
150 /* main uzbl data structure */
161 /* group bindings: key -> action */
162 GHashTable* bindings;
171 typedef void sigfunc(int);
176 gchar* environmental;
177 gchar* default_value;
182 { "XDG_CONFIG_HOME", "~/.config" },
183 { "XDG_DATA_HOME", "~/.local/share" },
184 { "XDG_CACHE_HOME", "~/.cache" },
185 { "XDG_CONFIG_DIRS", "/etc/xdg" },
186 { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" },
197 str_replace (const char* search, const char* replace, const char* string);
203 catch_sigterm(int s);
206 setup_signal(int signe, sigfunc *shandler);
209 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
212 create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);
215 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
218 toggle_status_cb (WebKitWebView* page, const char *param);
221 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
224 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
227 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
230 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
233 load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
236 destroy_cb (GtkWidget* widget, gpointer data);
245 free_action(gpointer act);
248 new_action(const gchar *name, const gchar *param);
251 file_exists (const char * filename);
254 set_insert_mode(WebKitWebView *page, const gchar *param);
257 load_uri (WebKitWebView * web_view, const gchar *param);
260 new_window_load_uri (const gchar * uri);
263 close_uzbl (WebKitWebView *page, const char *param);
266 run_command(const char *command, const char *args, const gboolean sync, char **stdout);
269 spawn(WebKitWebView *web_view, const char *param);
272 spawn_sh(WebKitWebView *web_view, const char *param);
275 parse_command(const char *cmd, const char *param);
278 runcmd(WebKitWebView *page, const char *param);
281 parse_cmd_line(const char *ctl_line);
284 build_stream_name(int type, const gchar *dir);
287 var_is(const char *x, const char *y);
290 set_useragent(gchar *val);
293 control_fifo(GIOChannel *gio, GIOCondition condition);
296 init_fifo(gchar *dir);
299 control_stdin(GIOChannel *gio, GIOCondition condition);
305 init_socket(gchar *dir);
308 control_socket(GIOChannel *chan);
314 key_press_cb (WebKitWebView* page, GdkEventKey* event);
317 run_keycmd(const gboolean key_ret);
326 GtkWidget* create_window ();
329 add_binding (const gchar *key, const gchar *act);
332 get_xdg_var (XDG_Var xdg);
335 find_xdg_file (int xdg_type, char* filename);
341 search_text (WebKitWebView *page, const char *param);
344 run_js (WebKitWebView * web_view, const gchar *param);
346 static void handle_cookies (SoupSession *session,
350 save_cookies (SoupMessage *msg,
352 /* vi: set et ts=4: */