Refactored networking variables to use the new struct concept
[uzbl-mobile] / uzbl.h
1 /* status bar elements */
2 typedef struct {
3     gint           load_progress;
4 } StatusBar;
5
6 /* gui elements */
7 typedef struct {
8     GtkWidget*     main_window;
9     GtkWidget*     mainbar;
10     GtkWidget*     mainbar_label;
11     GtkScrollbar*  scbar_v;   // Horizontal and Vertical Scrollbar
12     GtkScrollbar*  scbar_h;   // (These are still hidden)
13     GtkAdjustment* bar_v; // Information about document length
14     GtkAdjustment* bar_h; // and scrolling position
15     WebKitWebView* web_view;
16     gchar*         main_title;
17
18     StatusBar sbar;
19 } GUI;
20
21 /* external communication*/
22 typedef struct {
23     char           fifo_path[64];
24     char           socket_path[108];
25 } Communication;
26
27 /* internal state */
28 typedef struct {
29     gchar    *uri;
30     gchar    *config_file;
31     gchar    *instance_name;
32     gchar    config_file_path[500];
33 } State;
34
35 typedef struct {
36     SoupSession *soup_session;
37     SoupLogger *soup_logger;
38     char *proxy_url;
39     char *useragent;
40     gint max_conns;
41     gint max_conns_host;
42 } Network;
43
44
45 /* main uzbl data structure */
46 typedef struct {
47     GUI     gui;
48     Communication comm;
49     State   state;
50     Network net;
51     Window  xwin;
52 } Uzbl;
53
54 typedef struct {
55     char* name;
56     char* param;
57 } Action;
58
59
60 void
61 eprint(const char *errstr, ...);
62
63 char *
64 estrdup(const char *str);
65
66 char *
67 itos(int val);
68
69 static gboolean
70 new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
71
72 WebKitWebView*
73 create_web_view_cb (WebKitWebView  *web_view, WebKitWebFrame *frame, gpointer user_data);
74
75 static gboolean
76 download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
77
78 static void
79 toggle_status_cb (WebKitWebView* page, const char *param);
80
81 static void
82 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
83
84 static void
85 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data);
86
87 static void
88 progress_change_cb (WebKitWebView* page, gint progress, gpointer data);
89
90 static void
91 load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data);
92
93 static void
94 destroy_cb (GtkWidget* widget, gpointer data);
95
96 static void
97 log_history_cb ();
98
99 static void
100 commands_hash(void);
101
102 void
103 free_action(gpointer act);
104
105 Action*
106 new_action(const gchar *name, const gchar *param);
107
108 static bool
109 file_exists (const char * filename);
110
111 void
112 set_insert_mode(WebKitWebView *page, const gchar *param);
113
114 static void
115 load_uri (WebKitWebView * web_view, const gchar *param);
116
117 static void
118 new_window_load_uri (const gchar * uri);
119
120 static void
121 close_uzbl (WebKitWebView *page, const char *param);
122
123 static gboolean
124 run_command(const char *command, const char *args);
125
126 static void
127 spawn(WebKitWebView *web_view, const char *param);
128
129 static void
130 parse_command(const char *cmd, const char *param);
131
132 static void
133 parse_line(char *line);
134
135 void
136 build_stream_name(int type);
137
138 static void
139 control_fifo(GIOChannel *gio, GIOCondition condition);
140
141 static void
142 create_fifo();
143
144 static void
145 create_socket();
146
147 static void
148 control_socket(GIOChannel *chan);
149  
150
151 static void
152 update_title (void);
153  
154 static gboolean
155 key_press_cb (WebKitWebView* page, GdkEventKey* event);
156
157 static GtkWidget*
158 create_browser ();
159
160 static GtkWidget*
161 create_mainbar ();
162
163 static
164 GtkWidget* create_window ();
165
166 static void
167 add_binding (const gchar *key, const gchar *act);
168
169 static void
170 settings_init ();
171
172 static void
173 search_text (WebKitWebView *page, const char *param);
174
175 static void
176 run_js (WebKitWebView * web_view, const gchar *param);
177
178 static char *
179 str_replace (const char* search, const char* replace, const char* string);
180
181 /* vi: set et ts=4: */