X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=uzbl.h;h=00a7814203a0c3f72df7070adc996ea30539e77e;hb=f487c98743446a0b1af600338070afc94ed452ba;hp=bbc1f394372888a55eb736cf4889cd5a3e851cd5;hpb=aa03a11176e42cc21bca894e0141bf90fc80959b;p=uzbl-mobile diff --git a/uzbl.h b/uzbl.h index bbc1f39..00a7814 100644 --- a/uzbl.h +++ b/uzbl.h @@ -1,4 +1,4 @@ -/* -*- c-basic-offset: 4; -*- +/* -*- c-basic-offset: 4; -*- * See LICENSE for license details * @@ -11,47 +11,20 @@ * */ -#define NOSPLIT ((void*)1) - enum { /* statusbar symbols */ SYM_TITLE, SYM_URI, SYM_NAME, SYM_LOADPRGS, SYM_LOADPRGSBAR, SYM_KEYCMD, SYM_MODE, SYM_MSG, SYM_SELECTED_URI, - /* useragent symbols */ - SYM_WK_MAJ, SYM_WK_MIN, SYM_WK_MIC, - SYM_SYSNAME, SYM_NODENAME, - SYM_KERNREL, SYM_KERNVER, - SYM_ARCHSYS, SYM_ARCHUZBL, - SYM_DOMAINNAME, SYM_COMMIT }; const struct { gchar *symbol_name; guint symbol_token; } symbols[] = { - {"NAME", SYM_NAME}, - {"URI", SYM_URI}, - {"TITLE", SYM_TITLE}, - {"SELECTED_URI", SYM_SELECTED_URI}, {"KEYCMD", SYM_KEYCMD}, - {"MODE", SYM_MODE}, - {"MSG", SYM_MSG}, - {"LOAD_PROGRESS", SYM_LOADPRGS}, - {"LOAD_PROGRESSBAR", SYM_LOADPRGSBAR}, - - {"WEBKIT_MAJOR", SYM_WK_MAJ}, - {"WEBKIT_MINOR", SYM_WK_MIN}, - {"WEBKIT_MICRO", SYM_WK_MIC}, - {"SYSNAME", SYM_SYSNAME}, - {"NODENAME", SYM_NODENAME}, - {"KERNREL", SYM_KERNREL}, - {"KERNVER", SYM_KERNVER}, - {"ARCH_SYSTEM", SYM_ARCHSYS}, - {"ARCH_UZBL", SYM_ARCHUZBL}, - {"DOMAINNAME", SYM_DOMAINNAME}, - {"COMMIT", SYM_COMMIT}, + {NULL, 0} }, *symp = symbols; @@ -61,12 +34,16 @@ typedef struct { gchar *msg; gchar *progress_s, *progress_u; int progress_w; + gchar *progress_bar; + gchar *mode_indicator; } StatusBar; /* gui elements */ typedef struct { GtkWidget* main_window; + gchar* geometry; + GtkPlug* plug; GtkWidget* scrolled_win; GtkWidget* vbox; GtkWidget* mainbar; @@ -77,6 +54,7 @@ typedef struct { GtkAdjustment* bar_h; // and scrolling position WebKitWebView* web_view; gchar* main_title; + gchar* icon; /* WebInspector */ GtkWidget *inspector_window; @@ -93,6 +71,7 @@ typedef struct { gchar *socket_path; /* stores (key)"variable name" -> (value)"pointer to this var*/ GHashTable *proto_var; + gchar *sync_stdout; } Communication; @@ -101,12 +80,12 @@ typedef struct { typedef struct { gchar *uri; gchar *config_file; - char *instance_name; + int socket_id; + char *instance_name; gchar *selected_url; gchar *executable_path; - GString* keycmd; + gchar* keycmd; gchar* searchtx; - struct utsname unameinfo; /* system info */ gboolean verbose; } State; @@ -136,6 +115,13 @@ typedef struct { gchar* socket_dir; gchar* download_handler; gchar* cookie_handler; + gchar* new_window; + gchar* default_font_family; + gchar* monospace_font_family; + gchar* sans_serif_font_family; + gchar* serif_font_family; + gchar* fantasy_font_family; + gchar* cursive_font_family; gboolean always_insert_mode; gboolean show_status; gboolean insert_mode; @@ -149,31 +135,48 @@ typedef struct { guint font_size; guint monospace_size; guint minimum_font_size; + gfloat zoom_level; guint disable_plugins; guint disable_scripts; - guint autoload_img; - guint autoshrink_img; + guint autoload_img; + guint autoshrink_img; guint enable_spellcheck; - guint enable_private; - guint print_bg; - gchar* style_uri; - guint resizable_txt; - gchar* default_encoding; - guint enforce_96dpi; + guint enable_private; + guint print_bg; + gchar* style_uri; + guint resizable_txt; + gchar* default_encoding; + guint enforce_96dpi; gchar *inject_html; - guint caret_browsing; - guint mode; + guint caret_browsing; + guint mode; gchar* base_url; gchar* html_endmarker; gchar* insert_indicator; gchar* cmd_indicator; GString* html_buffer; - guint html_timeout; + guint html_timeout; + gboolean print_version; /* command list: name -> Command */ GHashTable* commands; } Behaviour; +/* javascript */ +typedef struct { + gboolean initialized; + JSClassDefinition classdef; + JSClassRef classref; +} Javascript; + +/* static information */ +typedef struct { + int webkit_major; + int webkit_minor; + int webkit_micro; + gchar *arch; + gchar *commit; +} Info; /* main uzbl data structure */ typedef struct { @@ -182,9 +185,10 @@ typedef struct { Network net; Behaviour behave; Communication comm; + Javascript js; + Info info; Window xwin; - GScanner *scan; /* group bindings: key -> action */ GHashTable* bindings; @@ -205,7 +209,7 @@ typedef struct { gchar* default_value; } XDG_Var; -XDG_Var XDG[] = +XDG_Var XDG[] = { { "XDG_CONFIG_HOME", "~/.config" }, { "XDG_DATA_HOME", "~/.local/share" }, @@ -215,73 +219,76 @@ XDG_Var XDG[] = }; /* Functions */ -static void -setup_scanner(); - char * itos(int val); -static char * +char * str_replace (const char* search, const char* replace, const char* string); -static GArray* +GArray* read_file_by_line (gchar *path); -static -gchar* parseenv (char* string); +gchar* +parseenv (char* string); -static void +void clean_up(void); -static void +void catch_sigterm(int s); -static sigfunc * +sigfunc * setup_signal(int signe, sigfunc *shandler); -static gboolean +gboolean set_var_value(gchar *name, gchar *val); -static void -print(WebKitWebView *page, GArray *argv); +void +print(WebKitWebView *page, GArray *argv, GString *result); -static gboolean +gboolean new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data); +gboolean +mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data); + WebKitWebView* create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data); -static gboolean +gboolean download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data); -static void -toggle_status_cb (WebKitWebView* page, GArray *argv); +void +toggle_zoom_type (WebKitWebView* page, GArray *argv, GString *result); + +void +toggle_status_cb (WebKitWebView* page, GArray *argv, GString *result); -static void +void link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data); -static void -title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data); +void +title_change_cb (WebKitWebView* web_view, GParamSpec param_spec); -static void +void progress_change_cb (WebKitWebView* page, gint progress, gpointer data); -static void +void load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data); -static void +void load_start_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data); -static void +void load_finish_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data); -static void +void destroy_cb (GtkWidget* widget, gpointer data); -static void +void log_history_cb (); -static void +void commands_hash(void); void @@ -290,248 +297,321 @@ free_action(gpointer act); Action* new_action(const gchar *name, const gchar *param); -static bool +bool file_exists (const char * filename); -static void -toggle_insert_mode(WebKitWebView *page, GArray *argv); +void +set_keycmd(); -static void -load_uri (WebKitWebView * web_view, GArray *argv); +void +set_mode_indicator(); + +void +update_indicator(); + +void +set_insert_mode(gboolean mode); + +void +toggle_insert_mode(WebKitWebView *page, GArray *argv, GString *result); + +void +load_uri (WebKitWebView * web_view, GArray *argv, GString *result); -static void +void new_window_load_uri (const gchar * uri); -static void -chain (WebKitWebView *page, GArray *argv); +void +chain (WebKitWebView *page, GArray *argv, GString *result); -static void -keycmd (WebKitWebView *page, GArray *argv); +void +keycmd (WebKitWebView *page, GArray *argv, GString *result); -static void -keycmd_nl (WebKitWebView *page, GArray *argv); +void +keycmd_nl (WebKitWebView *page, GArray *argv, GString *result); -static void -keycmd_bs (WebKitWebView *page, GArray *argv); +void +keycmd_bs (WebKitWebView *page, GArray *argv, GString *result); -static void -close_uzbl (WebKitWebView *page, GArray *argv); +void +close_uzbl (WebKitWebView *page, GArray *argv, GString *result); -static gboolean +gboolean run_command(const gchar *command, const guint npre, - const gchar **args, const gboolean sync, char **stdout); + const gchar **args, const gboolean sync, char **output_stdout); -static void -spawn(WebKitWebView *web_view, GArray *argv); +char* +build_progressbar_ascii(int percent); -static void -spawn_sh(WebKitWebView *web_view, GArray *argv); +void +talk_to_socket(WebKitWebView *web_view, GArray *argv, GString *result); -static void -spawn_sync(WebKitWebView *web_view, GArray *argv); +void +spawn(WebKitWebView *web_view, GArray *argv, GString *result); -static void -spawn_sh_sync(WebKitWebView *web_view, GArray *argv); +void +spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result); -static void -parse_command(const char *cmd, const char *param); +void +spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result); + +void +spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result); + +void +parse_command(const char *cmd, const char *param, GString *result); -static void -parse_cmd_line(const char *ctl_line); +void +parse_cmd_line(const char *ctl_line, GString *result); -static gchar* +gchar* build_stream_name(int type, const gchar *dir); -static gboolean +gboolean control_fifo(GIOChannel *gio, GIOCondition condition); -static gchar* +gchar* init_fifo(gchar *dir); -static gboolean +gboolean control_stdin(GIOChannel *gio, GIOCondition condition); -static void +void create_stdin(); -static gchar* +gchar* init_socket(gchar *dir); -static gboolean +gboolean control_socket(GIOChannel *chan); -static void +gboolean +control_client_socket(GIOChannel *chan); + +void update_title (void); -static gboolean +gboolean key_press_cb (GtkWidget* window, GdkEventKey* event); -static void +void run_keycmd(const gboolean key_ret); -static void +void exec_paramcmd(const Action* act, const guint i); -static GtkWidget* +void +initialize (); + +void create_browser (); -static GtkWidget* +GtkWidget* create_mainbar (); -static -GtkWidget* create_window (); +GtkWidget* +create_window (); -static void +GtkPlug* +create_plug (); + +void run_handler (const gchar *act, const gchar *args); -static void +void add_binding (const gchar *key, const gchar *act); -static gchar* +gchar* get_xdg_var (XDG_Var xdg); -static gchar* +gchar* find_xdg_file (int xdg_type, char* filename); -static void +void settings_init (); -static void +void search_text (WebKitWebView *page, GArray *argv, const gboolean forward); -static void -search_forward_text (WebKitWebView *page, GArray *argv); +void +search_forward_text (WebKitWebView *page, GArray *argv, GString *result); -static void -search_reverse_text (WebKitWebView *page, GArray *argv); +void +search_reverse_text (WebKitWebView *page, GArray *argv, GString *result); -static void -dehilight (WebKitWebView *page, GArray *argv); +void +dehilight (WebKitWebView *page, GArray *argv, GString *result); -static void -run_js (WebKitWebView * web_view, GArray *argv); +void +run_js (WebKitWebView * web_view, GArray *argv, GString *result); -static void -run_external_js (WebKitWebView * web_view, GArray *argv); +void +run_external_js (WebKitWebView * web_view, GArray *argv, GString *result); -static void handle_cookies (SoupSession *session, +void +eval_js(WebKitWebView * web_view, gchar *script, GString *result); + +void handle_cookies (SoupSession *session, SoupMessage *msg, gpointer user_data); -static void +void save_cookies (SoupMessage *msg, gpointer user_data); -static void -set_var(WebKitWebView *page, GArray *argv); +void +set_var(WebKitWebView *page, GArray *argv, GString *result); -static void -<<<<<<< HEAD:uzbl.h -======= -act_bind(WebKitWebView *page, GArray *argv); +void +act_bind(WebKitWebView *page, GArray *argv, GString *result); -static void ->>>>>>> dieterbe/experimental:uzbl.h +void act_dump_config(); -static void +void render_html(); -static void +void set_timeout(int seconds); -static void +void dump_var_hash(gpointer k, gpointer v, gpointer ud); -static void +void dump_key_hash(gpointer k, gpointer v, gpointer ud); -static void +void dump_config(); +void +retrieve_geometry(); + +void +update_gui(WebKitWebView *page, GArray *argv, GString *result); + +gboolean +configure_event_cb(GtkWidget* window, GdkEventConfigure* event); + +typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result); +typedef struct { + Command function; + gboolean no_split; +} CommandInfo; /* Command callbacks */ -static void +void cmd_load_uri(); -static void +void cmd_set_status(); -static void +void set_proxy_url(); -static void +void +set_icon(); + +void cmd_cookie_handler(); -static void +void +cmd_new_window(); + +void move_statusbar(); -static void +void cmd_always_insert_mode(); -static void +void cmd_http_debug(); -static void +void cmd_max_conns(); -static void +void cmd_max_conns_host(); -static void +/* exported WebKitWebSettings properties */ + +void cmd_font_size(); -static void +void +cmd_default_font_family(); + +void +cmd_monospace_font_family(); + +void +cmd_sans_serif_font_family(); + +void +cmd_serif_font_family(); + +void +cmd_cursive_font_family(); + +void +cmd_fantasy_font_family(); + +void +cmd_zoom_level(); + +void cmd_disable_plugins(); -static void +void cmd_disable_scripts(); -static void +void cmd_minimum_font_size(); -static void +void cmd_fifo_dir(); -static void +void cmd_socket_dir(); -static void +void cmd_modkey(); -static void +void cmd_useragent() ; -static void +void cmd_autoload_img(); -static void +void cmd_autoshrink_img(); -static void +void cmd_enable_spellcheck(); -static void +void cmd_enable_private(); -static void +void cmd_print_bg(); -static void +void cmd_style_uri(); -static void +void cmd_resizable_txt(); -static void +void cmd_default_encoding(); -static void +void cmd_enforce_96dpi(); -static void +void cmd_inject_html(); -static void +void cmd_caret_browsing(); +void +cmd_set_geometry(); + /* vi: set et ts=4: */