all repos — tint2 @ dff7355f3bf7b22515c5fecd078ae9bc7f3d6000

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

tint2conf: load old config files better
o9000 o9000
commit

dff7355f3bf7b22515c5fecd078ae9bc7f3d6000

parent

5d11fe5cc1bf42ed32e6a3cac86a9b05a1397d12

1 files changed, 54 insertions(+), 0 deletions(-)

jump to
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -13,6 +13,14 @@ void add_entry(char *key, char *value);

void hex2gdk(char *hex, GdkColor *color); void get_action(char *event, GtkWidget *combo); +int config_has_panel_items; +int config_has_battery; +int config_has_systray; +int config_battery_enabled; +int config_systray_enabled; +int no_items_clock_enabled; +int no_items_systray_enabled; +int no_items_battery_enabled; void config_read_file(const char *path) {

@@ -23,6 +31,15 @@

if ((fp = fopen(path, "r")) == NULL) return; + config_has_panel_items = 0; + config_has_battery = 0; + config_battery_enabled = 0; + config_has_systray = 0; + config_systray_enabled = 0; + no_items_clock_enabled = 0; + no_items_systray_enabled = 0; + no_items_battery_enabled = 0; + while (fgets(line, sizeof(line), fp) != NULL) { if (parse_line(line, &key, &value)) { add_entry(key, value);

@@ -31,6 +48,29 @@ free(value);

} } fclose(fp); + + if (!config_has_panel_items) { + char panel_items[256]; + panel_items[0] = 0; + strcat(panel_items, "T"); + if (config_has_battery) { + if (config_battery_enabled) + strcat(panel_items, "B"); + } else { + if (no_items_battery_enabled) + strcat(panel_items, "B"); + } + if (config_has_systray) { + if (config_systray_enabled) + strcat(panel_items, "S"); + } else { + if (no_items_systray_enabled) + strcat(panel_items, "S"); + } + if (no_items_clock_enabled) + strcat(panel_items, "C"); + set_panel_items(panel_items); + } } void config_write_color(FILE *fp, char *name, GdkColor color, int opacity)

@@ -635,6 +675,7 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_height_type), 1);

gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_height), atoi(value2)); } else if (strcmp(key, "panel_items") == 0) { + config_has_panel_items = 1; set_panel_items(value); } else if (strcmp(key, "panel_margin") == 0) {

@@ -785,6 +826,11 @@ }

} /* Battery */ + else if (strcmp(key, "systray") == 0) { + // Obsolete option + config_has_battery = 1; + config_battery_enabled = atoi(value); + } else if (strcmp(key, "battery_low_status") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value)); }

@@ -827,6 +873,7 @@

/* Clock */ else if (strcmp(key, "time1_format") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_format_line1), value); + no_items_clock_enabled = strlen(value) > 0; } else if (strcmp(key, "time2_format") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_format_line2), value);

@@ -1093,7 +1140,14 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltip_task_show), atoi(value));

} /* Systray */ + else if (strcmp(key, "systray") == 0) { + // Obsolete option + config_has_systray = 1; + config_systray_enabled = atoi(value); + } else if (strcmp(key, "systray_padding") == 0) { + no_items_systray_enabled = 1; + extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atoi(value1));