aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/uzbl-core.h
diff options
context:
space:
mode:
authorGravatar koral <koral@mailoo.org>2011-02-02 16:25:54 +0100
committerGravatar koral <koral@mailoo.org>2011-02-02 16:25:54 +0100
commit7fbebb427be655ee17de0b786e0ce9a3d86ea3d8 (patch)
treef6f24fb07f0345909c91199ee5379d7369deea28 /src/uzbl-core.h
parent375a896be26f1ee580fa80a7a73a272bc27a9287 (diff)
Cleaning/commenting uzbl-core.h.
Diffstat (limited to 'src/uzbl-core.h')
-rw-r--r--src/uzbl-core.h442
1 files changed, 167 insertions, 275 deletions
diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index f81722d..87f5ea9 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -44,8 +44,10 @@
#define LENGTH(x) (sizeof x / sizeof x[0])
-/* gui elements */
+
+/* GUI elements */
typedef struct {
+ /* Window */
GtkWidget* main_window;
gchar* geometry;
GtkPlug* plug;
@@ -57,31 +59,33 @@ typedef struct {
GtkWidget* mainbar_label_left;
GtkWidget* mainbar_label_right;
- GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
- GtkScrollbar* scbar_h; // (These are still hidden)
- GtkAdjustment* bar_v; // Information about document length
- GtkAdjustment* bar_h; // and scrolling position
+ /* Scrolling */
+ GtkScrollbar* scbar_v; /* Horizontal and Vertical Scrollbar */
+ GtkScrollbar* scbar_h; /* (These are still hidden) */
+ GtkAdjustment* bar_v; /* Information about document length */
+ GtkAdjustment* bar_h; /* and scrolling position */
int scrollbars_visible;
+
+ /* Web page */
WebKitWebView* web_view;
gchar* main_title;
gchar* icon;
/* WebInspector */
- GtkWidget *inspector_window;
- WebKitWebInspector *inspector;
+ GtkWidget* inspector_window;
+ WebKitWebInspector* inspector;
- /* custom context menu item */
+ /* Custom context menu item */
GPtrArray *menu_items;
} GUI;
-/* external communication*/
+/* External communication */
enum { FIFO, SOCKET};
typedef struct {
gchar *fifo_path;
gchar *socket_path;
- /* stores (key)"variable name" -> (value)"pointer to var*/
- GHashTable *proto_var;
+ GHashTable *proto_var; /* stores (key)"variable name" -> (value)"pointer to var */
gchar *sync_stdout;
GPtrArray *connect_chan;
@@ -89,68 +93,77 @@ typedef struct {
} Communication;
-/* internal state */
+/* Internal state */
typedef struct {
- gchar *uri;
- gchar *config_file;
- int socket_id;
- char *instance_name;
- gchar *selected_url;
- gchar *last_selected_url;
- gchar *executable_path;
- gchar* searchtx;
- gboolean verbose;
- gboolean events_stdout;
- GPtrArray *event_buffer;
- gchar** connect_socket_names;
- GdkEventButton *last_button;
- gboolean plug_mode;
+ gchar* uri;
+ gchar* config_file;
+ char* instance_name;
+ gchar* selected_url;
+ gchar* last_selected_url;
+ gchar* executable_path;
+ gchar* searchtx;
+ gboolean verbose;
+ GdkEventButton* last_button;
+ gboolean plug_mode;
+
+ /* Events */
+ int socket_id;
+ gboolean events_stdout;
+ GPtrArray* event_buffer;
+ gchar** connect_socket_names;
} State;
-/* networking */
+/* Networking */
typedef struct {
- SoupSession *soup_session;
- UzblCookieJar *soup_cookie_jar;
- SoupLogger *soup_logger;
- char *proxy_url;
- char *useragent;
- char *accept_languages;
- gint max_conns;
- gint max_conns_host;
+ SoupSession* soup_session;
+ UzblCookieJar* soup_cookie_jar;
+ SoupLogger* soup_logger;
+ char* proxy_url;
+ char* useragent;
+ char* accept_languages;
+ gint max_conns;
+ gint max_conns_host;
} Network;
-/* behaviour */
+/* Behaviour */
typedef struct {
/* Status bar */
gchar* status_format;
gchar* status_format_right;
gchar* status_background;
+ gboolean show_status;
+ gboolean status_top;
/* Window title */
gchar* title_format_short;
gchar* title_format_long;
+ /* Communication */
gchar* fifo_dir;
gchar* socket_dir;
+
+ /* Handlers */
gchar* cookie_handler;
gchar* authentication_handler;
+ gchar* scheme_handler;
+ gchar* download_handler;
+
+ /* Fonts */
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;
- gchar* scheme_handler;
- gchar* download_handler;
- gboolean show_status;
+
gboolean forward_keys;
- gboolean status_top;
guint modmask;
guint http_debug;
gchar* shell_cmd;
guint view_source;
+
/* WebKitWebSettings exports */
guint font_size;
guint monospace_size;
@@ -177,30 +190,33 @@ typedef struct {
gboolean print_version;
/* command list: (key)name -> (value)Command */
- /* command list: (key)name -> (value)Command */
GHashTable* commands;
+
/* event lookup: (key)event_id -> (value)event_name */
GHashTable *event_lookup;
} Behaviour;
-/* javascript */
+
+/* Javascript */
typedef struct {
gboolean initialized;
JSClassDefinition classdef;
JSClassRef classref;
} Javascript;
-/* static information */
+
+/* Static information */
typedef struct {
- int webkit_major;
- int webkit_minor;
- int webkit_micro;
- gchar *arch;
- gchar *commit;
- gchar *pid_str;
+ int webkit_major;
+ int webkit_minor;
+ int webkit_micro;
+ gchar* arch;
+ gchar* commit;
+ gchar* pid_str;
} Info;
-/* main uzbl data structure */
+
+/* Main uzbl data structure */
typedef struct {
GUI gui;
State state;
@@ -213,12 +229,12 @@ typedef struct {
Window xwin;
} UzblCore;
-/* Main Uzbl object */
-extern UzblCore uzbl;
+extern UzblCore uzbl; /* Main Uzbl object */
+
typedef void sigfunc(int);
-/* uzbl variables */
+/* Uzbl variables */
enum ptr_type {TYPE_INT, TYPE_STR, TYPE_FLOAT};
typedef struct {
enum ptr_type type;
@@ -232,262 +248,138 @@ typedef struct {
/*@null@*/ void (*func)(void);
} uzbl_cmdprop;
-/* Functions */
-char *
-itos(int val);
-
-gchar*
-strfree(gchar *str);
-
-void
-clean_up(void);
-
-void
-catch_sigterm(int s);
-
-sigfunc *
-setup_signal(int signe, sigfunc *shandler);
-
-gboolean
-set_var_value(const gchar *name, gchar *val);
-
-void
-load_uri_imp(gchar *uri);
-
-void
-print(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-commands_hash(void);
-
-void
-load_uri (WebKitWebView * web_view, GArray *argv, GString *result);
-
-void
-chain (WebKitWebView *page, GArray *argv, GString *result);
-
-void
-close_uzbl (WebKitWebView *page, GArray *argv, GString *result);
-
-gboolean
-run_command(const gchar *command, const gchar **args, const gboolean sync,
- char **output_stdout);
-
-void
-spawn_async(WebKitWebView *web_view, GArray *argv, GString *result);
-
-void
-spawn_sh_async(WebKitWebView *web_view, GArray *argv, GString *result);
-
-void
-spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
-
-void
-spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
-
-void
-spawn_sync_exec(WebKitWebView *web_view, GArray *argv, GString *result);
-
-void
-parse_command(const char *cmd, const char *param, GString *result);
-
-void
-parse_cmd_line(const char *ctl_line, GString *result);
+/* Functions */
+char* itos(int val);
+gchar* strfree(gchar *str);
+void clean_up(void);
+
+/* Signal management functions */
+void catch_sigterm(int s);
+sigfunc* setup_signal(int signe, sigfunc *shandler);
+
+gboolean set_var_value(const gchar *name, gchar *val);
+void load_uri_imp(gchar *uri);
+void print(WebKitWebView *page, GArray *argv, GString *result);
+void commands_hash(void);
+void load_uri(WebKitWebView * web_view, GArray *argv, GString *result);
+void chain(WebKitWebView *page, GArray *argv, GString *result);
+void close_uzbl(WebKitWebView *page, GArray *argv, GString *result);
+
+/* Running commands */
+gboolean run_command(const gchar *command, const gchar **args, const gboolean sync,
+ char **output_stdout);
+void spawn_async(WebKitWebView *web_view, GArray *argv, GString *result);
+void spawn_sh_async(WebKitWebView *web_view, GArray *argv, GString *result);
+void spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result);
+void spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result);
+void spawn_sync_exec(WebKitWebView *web_view, GArray *argv, GString *result);
+void parse_command(const char *cmd, const char *param, GString *result);
+void parse_cmd_line(const char *ctl_line, GString *result);
+
+/* Communication functions */
/*@null@*/ gchar*
build_stream_name(int type, const gchar *dir);
-gboolean
-control_fifo(GIOChannel *gio, GIOCondition condition);
+gboolean control_fifo(GIOChannel *gio, GIOCondition condition);
/*@null@*/ gchar*
init_fifo(gchar *dir);
-gboolean
-control_stdin(GIOChannel *gio, GIOCondition condition);
-
-void
-create_stdin();
+gboolean control_stdin(GIOChannel *gio, GIOCondition condition);
+void create_stdin();
/*@null@*/ gchar*
init_socket(gchar *dir);
-gboolean
-control_socket(GIOChannel *chan);
-
-gboolean
-control_client_socket(GIOChannel *chan);
-
-void
-update_title (void);
+gboolean control_socket(GIOChannel *chan);
+gboolean control_client_socket(GIOChannel *chan);
-gboolean
-key_press_cb (GtkWidget* window, GdkEventKey* event);
-gboolean
-key_release_cb (GtkWidget* window, GdkEventKey* event);
+void update_title(void);
-void
-initialize (int argc, char *argv[]);
+/* Keyboard events functions */
+gboolean key_press_cb(GtkWidget* window, GdkEventKey* event);
+gboolean key_release_cb(GtkWidget* window, GdkEventKey* event);
-void
-create_browser ();
+/* Initialization functions */
+void initialize(int argc, char *argv[]);
+void create_browser();
+GtkWidget* create_mainbar();
+GtkWidget* create_window();
+GtkPlug* create_plug();
+void run_handler(const gchar *act, const gchar *args);
+void settings_init();
-GtkWidget*
-create_mainbar ();
+/* Search functions */
+void search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
+void search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
+void search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
+void search_clear(WebKitWebView *page, GArray *argv, GString *result);
+void dehilight (WebKitWebView *page, GArray *argv, GString *result);
-GtkWidget*
-create_window ();
+/* Javascript functions */
+void run_js (WebKitWebView * web_view, GArray *argv, GString *result);
+void run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
+void eval_js(WebKitWebView * web_view, gchar *script, GString *result, const gchar *script_file);
-GtkPlug*
-create_plug ();
-
-void
-run_handler (const gchar *act, const gchar *args);
-
-void
-settings_init ();
-
-void
-search_text (WebKitWebView *page, GArray *argv, const gboolean forward);
-
-void
-search_forward_text (WebKitWebView *page, GArray *argv, GString *result);
-
-void
-search_reverse_text (WebKitWebView *page, GArray *argv, GString *result);
-
-void
-search_clear(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-dehilight (WebKitWebView *page, GArray *argv, GString *result);
-
-void
-run_js (WebKitWebView * web_view, GArray *argv, GString *result);
-
-void
-run_external_js (WebKitWebView * web_view, GArray *argv, GString *result);
-
-void
-eval_js(WebKitWebView * web_view, gchar *script, GString *result, const gchar *script_file);
-
-void
-handle_authentication (SoupSession *session,
+/* Network functions */
+void handle_authentication (SoupSession *session,
SoupMessage *msg,
SoupAuth *auth,
gboolean retrying,
gpointer user_data);
-
-void handle_cookies (SoupSession *session,
+void handle_cookies (SoupSession *session,
SoupMessage *msg,
gpointer user_data);
-
-void
-set_var(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-act_dump_config();
-
-void
-act_dump_config_as_events();
-
-void
-dump_var_hash(gpointer k, gpointer v, gpointer ud);
-
-void
-dump_key_hash(gpointer k, gpointer v, gpointer ud);
-
-void
-dump_config();
-
-void
-dump_config_as_events();
-
-void
-retrieve_geometry();
-
-void
-set_webview_scroll_adjustments();
-
-void
-event(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-init_connect_socket();
-
-gboolean
-remove_socket_from_array(GIOChannel *chan);
-
-void
-menu_add(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_link(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_image(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_edit(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_separator(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_separator_link(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_separator_image(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_add_separator_edit(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_remove(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_remove_link(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_remove_image(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-menu_remove_edit(WebKitWebView *page, GArray *argv, GString *result);
-
-gint
-get_click_context();
-
-void
-hardcopy(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-include(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-show_inspector(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-add_cookie(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-delete_cookie(WebKitWebView *page, GArray *argv, GString *result);
-
-void
-builtins();
+void set_var(WebKitWebView *page, GArray *argv, GString *result);
+void act_dump_config();
+void act_dump_config_as_events();
+void dump_var_hash(gpointer k, gpointer v, gpointer ud);
+void dump_key_hash(gpointer k, gpointer v, gpointer ud);
+void dump_config();
+void dump_config_as_events();
+
+void retrieve_geometry();
+void set_webview_scroll_adjustments();
+void event(WebKitWebView *page, GArray *argv, GString *result);
+void init_connect_socket();
+gboolean remove_socket_from_array(GIOChannel *chan);
+
+/* Contextual menu functions */
+void menu_add(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_link(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_image(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_edit(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_separator(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_separator_link(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_separator_image(WebKitWebView *page, GArray *argv, GString *result);
+void menu_add_separator_edit(WebKitWebView *page, GArray *argv, GString *result);
+void menu_remove(WebKitWebView *page, GArray *argv, GString *result);
+void menu_remove_link(WebKitWebView *page, GArray *argv, GString *result);
+void menu_remove_image(WebKitWebView *page, GArray *argv, GString *result);
+void menu_remove_edit(WebKitWebView *page, GArray *argv, GString *result);
+
+gint get_click_context();
+void hardcopy(WebKitWebView *page, GArray *argv, GString *result);
+void include(WebKitWebView *page, GArray *argv, GString *result);
+void show_inspector(WebKitWebView *page, GArray *argv, GString *result);
+void add_cookie(WebKitWebView *page, GArray *argv, GString *result);
+void delete_cookie(WebKitWebView *page, GArray *argv, GString *result);
+void builtins();
typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);
typedef struct {
- Command function;
+ Command function;
gboolean no_split;
} CommandInfo;
typedef struct {
- gchar *name;
- gchar *cmd;
+ gchar* name;
+ gchar* cmd;
gboolean issep;
- guint context;
+ guint context;
} MenuItem;