summaryrefslogtreecommitdiff
path: root/src/dwb.h
blob: 74c67b94c94dd6927d8b5ab9b9ee15c2be461cd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
/*
 * Copyright (c) 2010-2011 Stefan Bolte <portix@gmx.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef DWB_H
#define DWB_H
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <wchar.h>
#include <libgen.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <libsoup/soup.h>
#include <locale.h>
#include <stdarg.h>
#include <dirent.h>
#include <gtk/gtk.h>
#include <webkit/webkit.h>
#include <JavaScriptCore/JavaScript.h>
#include <gdk/gdkkeysyms.h> 

#ifndef NAME
#define NAME "dwb"
#endif
#ifndef REAL_NAME
#define REAL_NAME NAME
#endif
#ifndef VERSION
#define VERSION "0.0.18"
#endif
#ifndef COPYRIGHT
#define COPYRIGHT "© 2010-2011 Stefan Bolte"
#endif
/* SETTINGS MAKROS {{{*/
#define KEY_SETTINGS "xwb://keys"
#define SETTINGS "Dwb Settings"

#define SINGLE_INSTANCE 1
#define NEW_INSTANCE 2

#define PBAR_LENGTH   20
#define STRING_LENGTH 1024
#define BUFFER_LENGTH 256

// SETTTINGS_VIEW %s: bg-color  %s: fg-color %s: border
#define SETTINGS_VIEW "<head>\n<title>%s</title><style type=\"text/css\">\n \
  body { background-color: %s; color: %s; text-align:center; }\n\
  table { border-spacing:0px; }\n\
  th { border:%s; }\n \
  .line { vertical-align: middle; }\n \
  .text { float: left; font: normal 12px helvetica; }\n \
  .key { text-align: center;  font-size: 12; }\n \
  .active { background-color: #660000; }\n \
  h2 { font: bold 16px verdana; font-variant: small-caps; }\n \
  .alignCenter { margin-left: 25%%; width: 50%%; }\n \
  input { font:normal 12px helvetica;  }\
</style>\n \
<script type=\"text/javascript\">\n  \
function get_value(e) { value = e.value ? e.id + \" \" + e.value : e.id; console.log(value); e.blur(); } \
</script>\n<noscript>Enable scripts to add settings!</noscript>\n</head>\n"
#define HTML_H2  "<h2>%s -- Profile: %s</h2>"

#define HTML_BODY_START "<body>\n"
#define HTML_BODY_END "</body>\n"
#define HTML_FORM_START "<form onsubmit=\"return false\">\n<table width=100%; style=\"border:thin solid black\">"
#define HTML_FORM_END "</form>\n</table>\n</div>\n"
#define HTML_DIV_START "<tr>\n"
#define HTML_DIV_KEYS_TEXT "<th width=100%%><div class=\"text\">%s</div>\n</th> "
#define HTML_DIV_KEYS_VALUE "<th><div class=\"key\">\n <input onchange=\"get_value(this)\" id=\"%s\" value=\"%s %s\"/>\n</div></th>\n"
#define HTML_DIV_SETTINGS_VALUE "<th><div class=\"key\">\n <input onchange=\"get_value(this);\" id=\"%s\" value=\"%s\"/>\n</div>\n</th>"
#define HTML_DIV_SETTINGS_CHECKBOX "<th><div class=\"key\">\n <input id=\"%s\" type=\"checkbox\" onchange=\"get_value(this);\" %s>\n</div>\n</th>"
#define HTML_DIV_END "</tr>\n"
/*}}}*/
#define INSERT "Insert Mode"

#define NO_URL                      "No URL in current context"
#define NO_HINTS                    "No Hints in current context"

#define HINT_SEARCH_SUBMIT "_dwb_search_submit_"


/* MAKROS {{{*/ 
#define LENGTH(X)   (sizeof(X)/sizeof(X[0]))
#define GLENGTH(X)  (sizeof(X)/g_array_get_element_size(X)) 
#define NN(X)       ( ((X) == 0) ? 1 : (X) )

#define CLEAN_STATE(X) (X->state & ~(GDK_SHIFT_MASK) & ~(GDK_BUTTON1_MASK) & ~(GDK_BUTTON2_MASK) & ~(GDK_BUTTON3_MASK) & ~(GDK_BUTTON4_MASK) & ~(GDK_BUTTON5_MASK) & ~(GDK_LOCK_MASK) & ~(GDK_MOD2_MASK) &~(GDK_MOD3_MASK) & ~(GDK_MOD5_MASK))
#define CLEAN_SHIFT(X) (X->state & ~(GDK_SHIFT_MASK) & ~(GDK_LOCK_MASK))
#define CLEAN_COMP_MODE(X)          (X & ~(COMPLETION_MODE) & ~(AUTO_COMPLETE))

#define GET_TEXT()                  (gtk_entry_get_text(GTK_ENTRY(dwb.gui.entry)))
#define CURRENT_VIEW()              ((View*)dwb.state.fview->data)
#define VIEW(X)                     ((View*)X->data)
#define WEBVIEW(X)                  (WEBKIT_WEB_VIEW(((View*)X->data)->web))
#define CURRENT_WEBVIEW()           (WEBKIT_WEB_VIEW(((View*)dwb.state.fview->data)->web))
#define VIEW_FROM_ARG(X)            (X && X->p ? ((GSList*)X->p)->data : dwb.state.fview->data)
#define WEBVIEW_FROM_ARG(arg)       (WEBKIT_WEB_VIEW(((View*)(arg && arg->p ? ((GSList*)arg->p)->data : dwb.state.fview->data))->web))
#define CLEAR_COMMAND_TEXT(X)       dwb_set_status_bar_text(VIEW(X)->lstatus, NULL, NULL, NULL, false)

#define CURRENT_URL()               webkit_web_view_get_uri(CURRENT_WEBVIEW())

#define FOO                         puts("bar")

#define IS_WORD_CHAR(c)           (isalnum(c) || ((c) == '_')) 
// compare string a and b, without newline in string b

#define STRCMP_SKIP_NEWLINE(a, b)   (strncmp((a), (b), strstr((b), "\n") - (b)))
#define STRCMP_FIRST_WORD(a, b)     (strncmp((a), (b), MAX(strstr((a), " ") - a, strstr((b), " ") - b)))

#define FREE(X)                     if ((X)) g_free((X))

#define ALPHA(X)    ((X->keyval >= GDK_KEY_A && X->keyval <= GDK_KEY_Z) ||  (X->keyval >= GDK_KEY_a && X->keyval <= GDK_KEY_z) || X->keyval == GDK_KEY_space)
#define DIGIT(X)   (X->keyval >= GDK_KEY_0 && X->keyval <= GDK_KEY_9)
#define DWB_TAB_KEY(e)              (e->keyval == GDK_KEY_Tab || e->keyval == GDK_KEY_ISO_Left_Tab)

// Settings
#define GET_CHAR(prop)              ((char*)(((WebSettings*)g_hash_table_lookup(dwb.settings, prop))->arg.p))
#define GET_BOOL(prop)              (((WebSettings*)g_hash_table_lookup(dwb.settings, prop))->arg.b)
#define GET_INT(prop)               (((WebSettings*)g_hash_table_lookup(dwb.settings, prop))->arg.i)
#define GET_DOUBLE(prop)            (((WebSettings*)g_hash_table_lookup(dwb.settings, prop))->arg.d)
#define NUMMOD                      (dwb.state.nummod < 1 ? 1 : dwb.state.nummod)

#ifdef DWB_DEBUG
#define PRINT_DEBUG(message, ...) fprintf(stderr, "In %s:%d:%s(): " message "\n", __FILE__, __LINE__, __func__,##__VA_ARGS__)  \

#else 
#define PRINT_DEBUG(message, ...) 
#endif
/*}}}*/


/* TYPES {{{*/

typedef struct _Arg Arg;
typedef struct _Color Color;
typedef struct _Completions Completions;
typedef struct _Dwb Dwb;
typedef struct _FileContent FileContent;
typedef struct _Files Files;
typedef struct _Font DwbFont;
typedef struct _FunctionMap FunctionMap;
typedef struct _Gui Gui;
typedef struct _Key Key;
typedef struct _KeyMap KeyMap;
typedef struct _KeyValue KeyValue;
typedef struct _Misc Misc;
typedef struct _Navigation Navigation;
typedef struct _Quickmark Quickmark;
typedef struct _Settings Settings;
typedef struct _State State;
typedef struct _View View;
typedef struct _ViewStatus ViewStatus;
typedef struct _WebSettings WebSettings;
/*}}}*/
typedef gboolean (*Command_f)(void*);
typedef gboolean (*Func)(void *, void*);
typedef void (*void_func)(void*);
typedef void (*S_Func)(void *, WebSettings *);
typedef void *(*Content_Func)(const char *);

typedef enum  {
  COMP_NONE         = 0x00,
  COMP_BOOKMARK     = 0x01,
  COMP_HISTORY      = 0x02,
  COMP_SETTINGS     = 0x03,
  COMP_KEY          = 0x04,
  COMP_COMMAND      = 0x05,
  COMP_USERSCRIPT   = 0x06,
  COMP_INPUT        = 0x07,
  COMP_SEARCH       = 0x08,
  COMP_PATH         = 0x09,
} CompletionType;

typedef enum {
  HIDE_TB_NEVER     = 0x02,
  HIDE_TB_ALWAYS    = 0x03,
  HIDE_TB_TILED     = 0x05,
} TabBarVisible;

typedef enum {
  NORMAL_MODE           = 1<<0,
  INSERT_MODE           = 1<<1,
  QUICK_MARK_SAVE       = 1<<3,
  QUICK_MARK_OPEN       = 1<<4 ,
  HINT_MODE             = 1<<5,
  FIND_MODE             = 1<<6,
  COMPLETION_MODE       = 1<<7,
  AUTO_COMPLETE         = 1<<8,
  COMMAND_MODE          = 1<<9,
  SEARCH_FIELD_MODE     = 1<<10,
  SETTINGS_MODE         = 1<<12,
  KEY_MODE              = 1<<13,
  DOWNLOAD_GET_PATH     = 1<<14,
  SAVE_SESSION          = 1<<15,
  COMPLETE_PATH         = 1<<16,
} Mode;


typedef enum {
  NEVER_SM      = 0x00,
  ALWAYS_SM     = 0x01,
  POST_SM       = 0x02,
} ShowMessage;


typedef enum { 
  NORMAL_LAYOUT    = 0,
  BOTTOM_STACK     = 1<<0 ,
  MAXIMIZED        = 1<<1 ,
} Layout;

typedef enum { 
  CHAR        = 0x01,
  INTEGER     = 0x02,
  DOUBLE      = 0x03,
  BOOLEAN     = 0x04,
  COLOR_CHAR  = 0x05,
  HTML_STRING = 0x06,
} DwbType;

typedef enum {
  APPLY_GLOBAL    = 0x01,
  APPLY_PER_VIEW  = 0x02,
} SettingsScope;

typedef enum { 
  DL_ACTION_DOWNLOAD  = 0x01,
  DL_ACTION_EXECUTE   = 0x02,
} DownloadAction;


#define APPEND  0x01
#define PREPEND  0x02

#define NO_ERROR  -1

typedef enum {
  ALLOW_HOST  = 1<<0,
  ALLOW_URI   = 1<<1,
  ALLOW_TMP   = 1<<2,
} ScriptAllow;

typedef enum {
  SCRIPTS_ALLOWED           = 1<<0,
  SCRIPTS_BLOCKED           = 1<<1,
  SCRIPTS_ALLOWED_TEMPORARY = 1<<2,
} ScriptState;

typedef enum {
  OPEN_NORMAL      = 1<<0, 
  OPEN_NEW_VIEW    = 1<<1, 
  OPEN_NEW_WINDOW  = 1<<2, 
  OPEN_DOWNLOAD    = 1<<3, 
  SET_URL          = 1<<4, 
} Open;

enum Signal {
  SIG_FIRST = 0, 
  SIG_BUTTON_PRESS,
  SIG_BUTTON_RELEASE,
  SIG_CLOSE_WEB_VIEW, 
  SIG_CONSOLE_MESSAGE,
  SIG_CREATE_PLUGIN,
  SIG_CREATE_WEB_VIEW,
  SIG_DOWNLOAD_REQUESTED,
  SIG_HOVERING_OVER_LINK, 
#if WEBKIT_CHECK_VERSION(1, 4, 0)
  SIG_ICON_LOADED, 
#endif
  SIG_MIME_TYPE,
  SIG_NAVIGATION,
  SIG_NEW_WINDOW,
  SIG_RESOURCE_REQUEST,
  SIG_WINDOW_OBJECT,
  SIG_LOAD_STATUS,
  SIG_LOAD_STATUS_AFTER,
  SIG_PROGRESS,
  SIG_TITLE,
  SIG_URI,
  SIG_SCROLL,
  SIG_VALUE_CHANGED,
  SIG_ENTRY_KEY_PRESS,
  SIG_ENTRY_KEY_RELEASE,
  SIG_ENTRY_ACTIVATE,
  SIG_TAB_BUTTON_PRESS, 
  SIG_POPULATE_POPUP, 
  
  SIG_LAST,
};

enum _Direction {
  SCROLL_UP             = GDK_SCROLL_UP,
  SCROLL_DOWN           = GDK_SCROLL_DOWN,
  SCROLL_LEFT           = GDK_SCROLL_LEFT, 
  SCROLL_RIGHT          = GDK_SCROLL_RIGHT, 
  SCROLL_HALF_PAGE_UP,
  SCROLL_HALF_PAGE_DOWN,
  SCROLL_PAGE_UP,
  SCROLL_PAGE_DOWN, 
  SCROLL_TOP,
  SCROLL_BOTTOM,
  SCROLL_PERCENT,
  SCROLL_PIXEL,
} Direction;

typedef enum {
  SSL_NONE,
  SSL_TRUSTED, 
  SSL_UNTRUSTED,
} SslState;

/*}}}*/


/* STRUCTS {{{*/
struct _Navigation {
  char *first;
  char *second;
};
struct _Arg {
  guint n;
  int i;
  double d;
  gpointer p;
  gpointer arg;
  gboolean b;
  char *e;
};
struct _Key {
  char *str;
  guint mod;
};
struct _KeyValue {
  const char *id;
  Key key;
};

#define FM_COMMANDLINE    1<<0
#define FM_DONT_SAVE      1<<1
struct _FunctionMap {
  Navigation n;
  int prop; 
  Func func;
  const char *error; 
  ShowMessage hide;
  Arg arg;
  gboolean entry;
};
struct _KeyMap {
  const char *key;
  guint mod;
  FunctionMap *map;
};
struct _Quickmark {
  char *key; 
  Navigation *nav;
};
struct _Completions {
  GList *active_comp;
  GList *completions;
  GList *auto_c;
  GList *active_auto_c;
  gboolean autocompletion;
  GList *path_completion;
  GList *active_path;
};
struct _State {
  GList *views;
  GList *fview;
  WebKitWebSettings *web_settings;
  Mode mode;
  GString *buffer;
  int nummod;
  Open nv;
  DwbType type;
  guint scriptlock;
  int size;
  GHashTable *settings_hash;
  SettingsScope setting_apply;
  gboolean forward_search;
  gboolean background_tabs;

  SoupCookieJar *cookiejar;
  SoupCookie *last_cookie;
  GSList *last_cookies;
  gboolean cookies_allowed;

  gboolean complete_history;
  gboolean complete_bookmarks;
  gboolean complete_searchengines;
  gboolean complete_commands;
  gboolean complete_userscripts;

  gboolean hidden_files;
  gboolean view_in_background;

  Layout layout;
  GList *last_com_history;

  GList *undo_list;

  char *search_engine;
  char *form_name;

  WebKitDownload *download;
  DownloadAction dl_action;
  char *download_command;
  char *mimetype_request;

  TabBarVisible tabbar_visible;
};

struct _WebSettings {
  Navigation n;
  gboolean builtin;
  gboolean global;
  DwbType type;
  Arg arg;
  S_Func func;
};
struct _ViewStatus {
  guint message_id;
  gboolean add_history;
  char *search_string;
  GList *downloads;
  char *mimetype;
  gboolean adblocker;
  gulong signals[SIG_LAST];
  int progress;
  SslState ssl;
  ScriptState scripts;
  int tab_height;
  char *hover_uri;
};

struct _View {
  GtkWidget *vbox;
  GtkWidget *web;
  GtkWidget *tabevent;
  GtkWidget *tabbox;
#if WEBKIT_CHECK_VERSION(1, 4, 0)
  GtkWidget *tabicon;
#endif
  GtkWidget *tablabel;
  GtkWidget *statusbox;
  GtkWidget *urilabel;
  GtkWidget *rstatus;
  GtkWidget *lstatus;
  GtkWidget *scroll; 
  GtkWidget *entry;
  GtkWidget *autocompletion;
  GtkWidget *compbox;
  GtkWidget *bottombox;
  ViewStatus *status;
  GHashTable *setting;
};
struct _Color {
  GdkColor active_fg;
  GdkColor active_bg;
  GdkColor normal_fg;
  GdkColor normal_bg;
  GdkColor ssl_trusted;
  GdkColor ssl_untrusted;
  GdkColor tab_active_fg;
  GdkColor tab_active_bg;
  GdkColor tab_normal_fg;
  GdkColor tab_normal_bg;
  GdkColor insert_bg;
  GdkColor insert_fg;
  GdkColor error;
  GdkColor active_c_fg;
  GdkColor active_c_bg;
  GdkColor normal_c_fg;
  GdkColor normal_c_bg;
  GdkColor download_fg;
  GdkColor download_bg;
  char *settings_bg_color;
  char *settings_fg_color;
  char *tab_number_color;
  char *allow_color;
  char *block_color;
};
struct _Font {
  PangoFontDescription *fd_active;
  PangoFontDescription *fd_inactive;
  PangoFontDescription *fd_entry;
  PangoFontDescription *fd_completion;
};
struct _Setting {
  gboolean inc_search;
  gboolean wrap_search;
};

struct _Gui {
  GtkWidget *window;
  GtkWidget *vbox;
  GtkWidget *topbox;
  GtkWidget *paned;
  GtkWidget *right;
  GtkWidget *left;
  GtkWidget *entry;
  GtkWidget *downloadbar;
  int width;
  int height;
};
struct _Misc {
  const char *name;
  const char *prog_path;
  char *scripts;
  const char *profile;
  const char *default_search;
  SoupSession *soupsession;
  SoupURI *proxyuri;

  GIOChannel *si_channel;
  GList *userscripts;

  double factor;
  int max_c_items;
  int message_delay;
  int history_length;

  char *settings_border;
  int argc;
  char **argv;

  gboolean tabbed_browsing;
  gboolean private_browsing;

  double scroll_step;

  char *startpage;
  char *download_com;
  JSContextRef global_ctx;
  int tab_height;
};
struct _Files {
  const char *bookmarks;
  const char *cookies;
  const char *cookies_allow;
  const char *download_path;
  const char *fifo;
  const char *history;
  const char *keys;
  const char *mimetypes;
  const char *quickmarks;
  const char *scriptdir;
  const char *searchengines;
  const char *session;
  const char *settings;
  const char *stylesheet;
  const char *unifile;
  const char *userscripts;
  const char *adblock;
  const char *dir_icon;
  const char *file_icon;
  const char *exec_icon;
  const char *scripts_allow;
};
// TODO implement plugins blocker, script blocker with File struct
typedef struct _File {
  unsigned long int mod;
  char *filename; 
  GList *content;
} File;
struct _FileContent {
  GList *bookmarks;
  GList *history;
  GList *quickmarks;
  GList *searchengines;
  GList *se_completion;
  GList *keys;
  GList *settings;
  GList *cookies_allow;
  GList *commands;
  GList *mimetypes;
  GList *adblock;
  GList *tmp_scripts;
  GList *scripts_allow;
};

struct _Dwb {
  Gui gui;
  Color color;
  DwbFont font;
  Misc misc;
  State state;
  Completions comps;
  GList *keymap;
  GHashTable *settings;
  Files files;
  FileContent fc;
};

/*}}}*/

/* VARIABLES {{{*/
Dwb dwb;
/*}}}*/

gboolean dwb_insert_mode(Arg *);
void dwb_normal_mode(gboolean);

void dwb_load_uri(GList *gl, Arg *);
void dwb_execute_user_script(KeyMap *km, Arg *a);

void dwb_focus_entry(void);
void dwb_focus_scroll(GList *);

gboolean dwb_update_search(gboolean forward);

void dwb_set_normal_message(GList *, gboolean, const char *, ...);
void dwb_set_error_message(GList *, const char *, ...);
void dwb_set_status_text(GList *, const char *, GdkColor *,  PangoFontDescription *);
void dwb_set_status_bar_text(GtkWidget *, const char *, GdkColor *,  PangoFontDescription *, gboolean);
void dwb_update_status_text(GList *gl, GtkAdjustment *);
void dwb_update_status(GList *gl);
void dwb_update_layout(gboolean);
void dwb_focus(GList *gl);

gboolean dwb_prepend_navigation(GList *, GList **);
void dwb_prepend_navigation_with_argument(GList **, const char *, const char *);

Navigation * dwb_navigation_from_webkit_history_item(WebKitWebHistoryItem *);
gboolean dwb_update_hints(GdkEventKey *);
gboolean dwb_search(KeyMap *, Arg *);
void dwb_submit_searchengine(void);
void dwb_save_searchengine(void);
char * dwb_execute_script(WebKitWebView *, const char *, gboolean);
void dwb_resize(double );
void dwb_toggle_tabbar(void);
int dwb_history_back(void);
int dwb_history_forward(void);

void dwb_grab_focus(GList *);
void dwb_source_remove(GList *);
gboolean dwb_spawn(GList *, const char *, const char *uri);

int dwb_entry_position_word_back(int position);
int dwb_entry_position_word_forward(int position);
void dwb_entry_set_text(const char *text);

void dwb_set_proxy(GList *, WebSettings *);

void dwb_set_single_instance(GList *, WebSettings *);
void dwb_new_window(Arg *arg);

gboolean dwb_eval_editing_key(GdkEventKey *);
void dwb_parse_command_line(const char *);
GHashTable * dwb_get_default_settings(void);

gboolean dwb_end(void);
Key dwb_str_to_key(char *);

GList * dwb_keymap_add(GList *, KeyValue );

void dwb_save_settings(void);
gboolean dwb_save_files(gboolean);
CompletionType dwb_eval_completion_type(void);

void dwb_append_navigation_with_argument(GList **, const char *, const char *);
void dwb_clean_load_end(GList *);
gboolean dwb_block_ad(GList *gl, const char *);
const char * dwb_check_directory(const char *);
void dwb_update_uri(GList *);
gboolean dwb_get_allowed(const char *, const char *);
gboolean dwb_toggle_allowed(const char *, const char *);
char * dwb_get_host(WebKitWebView *);
void dwb_focus_view(GList *);
void dwb_clean_key_buffer(void);

#endif