-int parse_line (const char *line)
-{
- char *a, *b, *key, *value;
-
- /* Skip useless lines */
- if ((line[0] == '#') || (line[0] == '\n')) return 0;
- if (!(a = strchr (line, '='))) return 0;
-
- /* overwrite '=' with '\0' */
- a[0] = '\0';
- key = strdup (line);
- a++;
-
- /* overwrite '\n' with '\0' if '\n' present */
- if ((b = strchr (a, '\n'))) b[0] = '\0';
-
- value = strdup (a);
-
- g_strstrip(key);
- g_strstrip(value);
-
- add_entry (key, value);
-
- free (key);
- free (value);
- return 1;
-}
-
-
-void config_finish ()
-{
- if (panel_config->monitor > (server.nb_monitor-1)) {
- // server.nb_monitor minimum value is 1 (see get_monitors())
- // and panel_config->monitor is higher
- fprintf(stderr, "warning : monitor not found. tint2 default to monitor 1.\n");
- panel_config->monitor = 0;
- }
-
- // alloc panels
- int i;
- if (panel_config->monitor >= 0) {
- // one monitor
- nb_panel = 1;
- panel1 = calloc(nb_panel, sizeof(Panel));
- memcpy(panel1, panel_config, sizeof(Panel));
- panel1->monitor = panel_config->monitor;
- }
- else {
- // all monitors
- nb_panel = server.nb_monitor;
- panel1 = calloc(nb_panel, sizeof(Panel));
-
- for (i=0 ; i < nb_panel ; i++) {
- memcpy(&panel1[i], panel_config, sizeof(Panel));
- panel1[i].monitor = i;
- }
- }
-
- // TODO: user can configure layout => ordered objects in panel.area.list
- // clock and systray before taskbar because resize(clock) can resize others object ??
- init_panel();
- init_clock();
-#ifdef ENABLE_BATTERY
- init_battery();
-#endif
- init_systray();
- init_taskbar();
- init_tooltip();
- visible_object();
-
- cleanup_config();
-
- task_refresh_tasklist();
-}
-
-