Summary Files Commits Branches @commit @diff @stats
path: root / badwolf.h
blob: 4c9fa653b695fd3fd7d2a1f7137f06c097e3a9ce (plain) (blame)
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
#ifndef BADWOLF_H_INCLUDED
#define BADWOLF_H_INCLUDED

#include <gtk/gtk.h>
#include <webkit2/webkit2.h>

const gchar *homepage;
const gchar *version;

struct Window
{
	GtkWidget *main_window;
	GtkWidget *notebook;
	GtkWidget *new_tab;
};

struct Client
{
	GtkWidget *box;

	GtkWidget *toolbar;
	GtkWidget *javascript;
	GtkWidget *location;

	WebKitWebView *webView;
	struct Window *window;

	GtkWidget *statusbar;
	GtkWidget *statuslabel;
	GtkWidget *search;
};

/* badwolf_ensure_uri_scheme: tries to add a scheme on a pseudo-URL missing a scheme
 * - gchar text: pseudo-URL missing a scheme
 * - gboolean try_file: when TRUE check try first if it can be a file:// path
 *
 * When `text` isn't exploitable (ie. NULL), returns "about:blank",
 * when the URL seems to be valid, return it,
 * if try_file is TRUE, check if it can be file:// path,
 * some other checks might be added.
 * In the end use the fallback (`http://` for now, might get configuration),
 * might get some safeguard.
 */
gchar *badwolf_ensure_uri_scheme(gchar *text, gboolean try_file);
GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
void webView_tab_label_change(struct Client *browser, const gchar *title);
struct Client *
new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web_view);
int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser);
gint badwolf_get_tab_position(GtkContainer *notebook, GtkWidget *child);
#endif /* BADWOLF_H_INCLUDED */