Refactor configuration
[browser-switch] / config.h
diff --git a/config.h b/config.h
new file mode 100644 (file)
index 0000000..39df717
--- /dev/null
+++ b/config.h
@@ -0,0 +1,47 @@
+/*
+ * config.h -- definitions for Browser Switchboard configuration
+ *
+ * Copyright (C) 2009-2010 Steven Luo
+ * Derived from a Python implementation by Jason Simpson and Steven Luo
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define SWB_CONFIG_INITIALIZED                 0x01
+#define SWB_CONFIG_CONTINUOUS_MODE_SET         0x02
+#define SWB_CONFIG_DEFAULT_BROWSER_SET         0x04
+#define SWB_CONFIG_OTHER_BROWSER_CMD_SET       0x08
+#define SWB_CONFIG_LOGGING_SET                 0x10
+
+struct swb_config {
+       unsigned int flags;
+       int continuous_mode;
+       char *default_browser;
+       char *other_browser_cmd;
+       char *logging;
+};
+
+void swb_config_init(struct swb_config *cfg);
+void swb_config_free(struct swb_config *cfg);
+
+int swb_config_load(struct swb_config *cfg);
+
+int swb_config_save(struct swb_config *cfg);
+
+#endif /* _CONFIG_H */