diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-04-26 19:07:38 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-04-26 19:07:38 +0200 |
commit | 1170b063af66666be7d8fd60b939f5645e4e790f (patch) | |
tree | d66180f007c6a536926069dd558a950dc5888b57 /uzbl.c | |
parent | e651d469521b83a7fe0dc261824740d8049a1f5e (diff) |
support --config option + reorganize variables a bit in a clear hierachy
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 48 |
1 files changed, 29 insertions, 19 deletions
@@ -43,13 +43,23 @@ #include <unistd.h> #include <stdlib.h> +/* housekeeping / internal variables */ static GtkWidget* main_window; static GtkWidget* mainbar; static WebKitWebView* web_view; static gchar* main_title; static gchar selected_url[500]; +static gint load_progress; +static guint status_context_id; +static Window xwin = 0; +static char fifopath[64]; -/* Behaviour variables */ +/* state variables (initial values coming from command line arguments but may be changed later) */ +static gchar* uri = NULL; +static gchar* config_file = NULL; +static gboolean verbose = FALSE; + +/* settings from config: group behaviour */ static gchar* history_handler = NULL; static gchar* fifodir = NULL; static gchar* download_handler = NULL; @@ -58,21 +68,31 @@ static gboolean show_status = FALSE; static gboolean insert_mode = FALSE; static gchar* modkey = NULL; -static char fifopath[64]; -static gint load_progress; -static guint status_context_id; -static Window xwin = 0; -static gchar* uri = NULL; -static gboolean verbose = FALSE; +typedef struct +{ + const char *binding; + const char *action; +} Binding; +/* settings from config: group bindings_internal */ +static Binding internal_bindings[256]; +static int num_internal_bindings = 0; + +/* settings from config: group bindings_external */ +static Binding external_bindings[256]; +static int num_external_bindings = 0; + +/* commandline arguments (set initial values for the state variables) */ static GOptionEntry entries[] = { - { "uri", 'u', 0, G_OPTION_ARG_STRING, &uri, "Uri to load", NULL }, - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, + { "uri", 'u', 0, G_OPTION_ARG_STRING, &uri, "Uri to load", NULL }, + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, + { "config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Config file", NULL }, { NULL } }; +/* for internal list of commands */ typedef struct { const char *command; @@ -80,16 +100,6 @@ typedef struct void (*func_2_params)(WebKitWebView*, char *); } Command; -typedef struct -{ - const char *binding; - const char *action; -} Binding; - -static Binding internal_bindings[256]; -static Binding external_bindings[256]; -static int num_internal_bindings = 0; -static int num_external_bindings = 0; static void update_title (GtkWindow* window); |