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"
15 /* statusbar symbols */
16 enum { SYM_TITLE
, SYM_URI
, SYM_NAME
,
17 SYM_LOADPRGS
, SYM_LOADPRGSBAR
,
18 SYM_KEYCMD
, SYM_MODE
};
26 {"KEYCMD", SYM_KEYCMD
},
28 {"LOAD_PROGRESS", SYM_LOADPRGS
},
29 {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR
},
33 /* status bar elements */
41 GtkWidget
* main_window
;
43 GtkWidget
* mainbar_label
;
44 GtkScrollbar
* scbar_v
; // Horizontal and Vertical Scrollbar
45 GtkScrollbar
* scbar_h
; // (These are still hidden)
46 GtkAdjustment
* bar_v
; // Information about document length
47 GtkAdjustment
* bar_h
; // and scrolling position
48 WebKitWebView
* web_view
;
55 /* external communication*/
59 char socket_path
[108];
68 gchar config_file_path
[500];
69 gchar selected_url
[500];
70 char executable_path
[500];
73 struct utsname unameinfo
; /* system info */
79 SoupSession
*soup_session
;
80 SoupLogger
*soup_logger
;
91 gchar
* history_handler
;
94 gchar
* download_handler
;
95 gchar
* cookie_handler
;
96 gboolean always_insert_mode
;
104 /* command list: name -> Command */
105 GHashTable
* commands
;
109 /* main uzbl data structure */
120 /* group bindings: key -> action */
121 GHashTable
* bindings
;
130 typedef void sigfunc(int);
143 catch_sigterm(int s
);
146 setup_signal(int signe
, sigfunc
*shandler
);
149 new_window_cb (WebKitWebView
*web_view
, WebKitWebFrame
*frame
, WebKitNetworkRequest
*request
, WebKitWebNavigationAction
*navigation_action
, WebKitWebPolicyDecision
*policy_decision
, gpointer user_data
);
152 create_web_view_cb (WebKitWebView
*web_view
, WebKitWebFrame
*frame
, gpointer user_data
);
155 download_cb (WebKitWebView
*web_view
, GObject
*download
, gpointer user_data
);
158 toggle_status_cb (WebKitWebView
* page
, const char *param
);
161 link_hover_cb (WebKitWebView
* page
, const gchar
* title
, const gchar
* link
, gpointer data
);
164 title_change_cb (WebKitWebView
* web_view
, WebKitWebFrame
* web_frame
, const gchar
* title
, gpointer data
);
167 progress_change_cb (WebKitWebView
* page
, gint progress
, gpointer data
);
170 load_commit_cb (WebKitWebView
* page
, WebKitWebFrame
* frame
, gpointer data
);
173 destroy_cb (GtkWidget
* widget
, gpointer data
);
182 free_action(gpointer act
);
185 new_action(const gchar
*name
, const gchar
*param
);
188 file_exists (const char * filename
);
191 set_insert_mode(WebKitWebView
*page
, const gchar
*param
);
194 load_uri (WebKitWebView
* web_view
, const gchar
*param
);
197 new_window_load_uri (const gchar
* uri
);
200 close_uzbl (WebKitWebView
*page
, const char *param
);
203 run_command_async(const char *command
, const char *args
);
206 run_command_sync(const char *command
, const char *args
, char **stdout
);
209 spawn(WebKitWebView
*web_view
, const char *param
);
212 parse_command(const char *cmd
, const char *param
);
215 parse_line(char *line
);
218 build_stream_name(int type
);
221 control_fifo(GIOChannel
*gio
, GIOCondition condition
);
230 control_socket(GIOChannel
*chan
);
237 key_press_cb (WebKitWebView
* page
, GdkEventKey
* event
);
246 GtkWidget
* create_window ();
249 add_binding (const gchar
*key
, const gchar
*act
);
255 search_text (WebKitWebView
*page
, const char *param
);
258 run_js (WebKitWebView
* web_view
, const gchar
*param
);
261 str_replace (const char* search
, const char* replace
, const char* string
);
263 static void handle_cookies (SoupSession
*session
,
267 save_cookies (SoupMessage
*msg
,
269 /* vi: set et ts=4: */