aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar Barrucadu <mike@barrucadu.co.uk>2009-04-26 19:53:31 +0100
committerGravatar Barrucadu <mike@barrucadu.co.uk>2009-04-26 19:53:31 +0100
commit7f18fe17f72c75c0fa77aa604021835864a94787 (patch)
tree87d3b441e8d1891bcf6dccd5304359e8fa3338a4 /uzbl.c
parent554efcc293ff9d3c23da0c686bbb78b136318575 (diff)
Now runs if no config file is specified (just don't expect it to be very useful).
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c108
1 files changed, 56 insertions, 52 deletions
diff --git a/uzbl.c b/uzbl.c
index 8e9b4e3..9337e08 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -395,66 +395,70 @@ add_binding (char *binding, char *action, bool internal) {
static void
settings_init () {
- printf("Config file: %s\n", config_file);
- GKeyFile* config = g_key_file_new ();
- gboolean res = g_key_file_load_from_file (config, config_file, G_KEY_FILE_NONE, NULL); //TODO: pass config file as argument
- if (res) {
- printf ("Config loaded\n");
- } else {
- fprintf (stderr, "Config loading failed\n"); //TODO: exit codes with gtk?
- }
+ if (config_file) {
+ printf("Config file: %s\n", config_file);
- history_handler = g_key_file_get_value (config, "behavior", "history_handler", NULL);
- if (history_handler) {
- printf ("History handler: %s\n", history_handler);
- } else {
- printf ("History handler disabled\n");
- }
+ GKeyFile* config = g_key_file_new ();
+ gboolean res = g_key_file_load_from_file (config, config_file, G_KEY_FILE_NONE, NULL); //TODO: pass config file as argument
- download_handler = g_key_file_get_value (config, "behavior", "download_handler", NULL);
- if (download_handler) {
- printf ("Download manager: %s\n", download_handler);
- } else {
- printf ("Download manager disabled\n");
- }
+ if (res) {
+ printf ("Config loaded\n");
+ } else {
+ fprintf (stderr, "Config loading failed\n"); //TODO: exit codes with gtk?
+ }
- if (! fifodir)
- fifodir = g_key_file_get_value (config, "behavior", "fifodir", NULL);
- if (fifodir) {
- printf ("Fifo directory: %s\n", fifodir);
- } else {
- printf ("Fifo directory: /tmp\n");
- }
+ history_handler = g_key_file_get_value (config, "behavior", "history_handler", NULL);
+ if (history_handler) {
+ printf ("History handler: %s\n", history_handler);
+ } else {
+ printf ("History handler disabled\n");
+ }
- always_insert_mode = g_key_file_get_boolean (config, "behavior", "always_insert_mode", NULL);
- printf ("Always insert mode: %s\n", (always_insert_mode ? "TRUE" : "FALSE"));
+ download_handler = g_key_file_get_value (config, "behavior", "download_handler", NULL);
+ if (download_handler) {
+ printf ("Download manager: %s\n", download_handler);
+ } else {
+ printf ("Download manager disabled\n");
+ }
+
+ if (! fifodir)
+ fifodir = g_key_file_get_value (config, "behavior", "fifodir", NULL);
+ if (fifodir) {
+ printf ("Fifo directory: %s\n", fifodir);
+ } else {
+ printf ("Fifo directory: /tmp\n");
+ }
+
+ always_insert_mode = g_key_file_get_boolean (config, "behavior", "always_insert_mode", NULL);
+ printf ("Always insert mode: %s\n", (always_insert_mode ? "TRUE" : "FALSE"));
+
+ show_status = g_key_file_get_boolean (config, "behavior", "show_status", NULL);
+ printf ("Show status: %s\n", (show_status ? "TRUE" : "FALSE"));
- show_status = g_key_file_get_boolean (config, "behavior", "show_status", NULL);
- printf ("Show status: %s\n", (show_status ? "TRUE" : "FALSE"));
+ modkey = g_key_file_get_value (config, "behavior", "modkey", NULL);
+ if (modkey) {
+ printf ("Mod key: %s\n", modkey);
+ } else {
+ printf ("Mod key disabled/\n");
+ }
+
+ gchar **keysi = g_key_file_get_keys (config, "bindings_internal", NULL, NULL);
+ int i = 0;
+ for (i = 0; keysi[i]; i++) {
+ gchar *binding = g_key_file_get_string (config, "bindings_internal", keysi[i], NULL);
+ printf ("Action: %s, Binding: %s (internal)\n", g_strdup (keysi[i]), binding);
+ add_binding (binding, g_strdup (keysi[i]), true);
+ }
- modkey = g_key_file_get_value (config, "behavior", "modkey", NULL);
- if (modkey) {
- printf ("Mod key: %s\n", modkey);
+ gchar **keyse = g_key_file_get_keys (config, "bindings_external", NULL, NULL);
+ for (i = 0; keyse[i]; i++) {
+ gchar *binding = g_key_file_get_string(config, "bindings_external", keyse[i], NULL);
+ printf ("Action: %s, Binding: %s (external)\n", g_strdup (keyse[i]), binding);
+ add_binding (binding, g_strdup (keyse[i]), false);
+ }
} else {
- printf ("Mod key disabled/\n");
+ printf ("No configuration.\n");
}
-
- gchar **keysi = g_key_file_get_keys (config, "bindings_internal", NULL, NULL);
- int i = 0;
- for (i = 0; keysi[i]; i++)
- {
- gchar *binding = g_key_file_get_string(config, "bindings_internal", keysi[i], NULL);
- printf("Action: %s, Binding: %s (internal)\n", g_strdup (keysi[i]), binding);
- add_binding (binding, g_strdup (keysi[i]), true);
- }
-
- gchar **keyse = g_key_file_get_keys (config, "bindings_external", NULL, NULL);
- for (i = 0; keyse[i]; i++)
- {
- gchar *binding = g_key_file_get_string(config, "bindings_external", keyse[i], NULL);
- printf("Action: %s, Binding: %s (external)\n", g_strdup (keyse[i]), binding);
- add_binding (binding, g_strdup (keyse[i]), false);
- }
}
int