all repos — tint2 @ ffe45bd7da4af0f6ff8aee47eb40fc2f88fd1c00

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

panel_items : backward compatibility with 0.11 config file

git-svn-id: http://tint2.googlecode.com/svn/trunk@552 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

ffe45bd7da4af0f6ff8aee47eb40fc2f88fd1c00

parent

8b71e3614c8e7d35787d344880e8558114963e70

3 files changed, 47 insertions(+), 6 deletions(-)

jump to
M src/config.csrc/config.c

@@ -59,14 +59,14 @@

// -------------------------------------------------- // backward compatibility // detect if it's an old config file (==1) -static int old_config_file; +static int new_config_file; void default_config() { config_path = 0; snapshot_path = 0; - old_config_file = 1; + new_config_file = 0; } void cleanup_config()

@@ -236,7 +236,7 @@ panel_config.area.height = atoi(value2);

} } else if (strcmp (key, "panel_items") == 0) { - if (panel_items_order) g_free(panel_items_order); + new_config_file = 1; panel_items_order = strdup(value); int j; for (j=0 ; j < strlen(panel_items_order) ; j++) {

@@ -372,6 +372,13 @@ }

/* Clock */ else if (strcmp (key, "time1_format") == 0) { + if (new_config_file == 0) { + clock_enabled = 1; + if (panel_items_order) + panel_items_order = strcat(panel_items_order, "C"); + else + panel_items_order = strdup("C"); + } if (strlen(value) > 0) { time1_format = strdup (value); clock_enabled = 1;

@@ -633,6 +640,29 @@ panel_autohide_height = 1;

} } + // old config option + else if (strcmp(key, "systray") == 0) { + if (new_config_file == 0) { + systray_enabled = atoi(value); + if (systray_enabled) { + if (panel_items_order) + panel_items_order = strcat(panel_items_order, "S"); + else + panel_items_order = strdup("S"); + } + } + } + else if (strcmp(key, "battery") == 0) { + if (new_config_file == 0) { + battery_enabled = atoi(value); + if (battery_enabled) { + if (panel_items_order) + panel_items_order = strcat(panel_items_order, "B"); + else + panel_items_order = strdup("B"); + } + } + } else fprintf(stderr, "tint2 : invalid option \"%s\",\n upgrade tint2 or correct your config file\n", key);

@@ -705,6 +735,17 @@ free (value);

} } fclose (fp); + + // append Taskbar item + if (new_config_file == 0) { + taskbar_enabled = 1; + if (panel_items_order) { + char *tmp = strdup("T"); + panel_items_order = strcat(tmp, panel_items_order); + } + else + panel_items_order = strdup("T"); + } return 1; }
M src/panel.csrc/panel.c

@@ -80,7 +80,7 @@ default_icon = NULL;

task_dragged = 0; panel_horizontal = 1; panel_position = CENTER; - panel_items_order = strdup("LTBSC"); // Default order : Launcher, Taskbar, Battery, Systray, Clock + panel_items_order = 0; panel_autohide = 0; panel_autohide_show_timeout = 0; panel_autohide_hide_timeout = 0;

@@ -461,7 +461,7 @@ if (p->area.list) {

g_slist_free(p->area.list); p->area.list = 0; } - + printf("panel_items_order %s\n", panel_items_order); for (k=0 ; k < strlen(panel_items_order) ; k++) { if (panel_items_order[k] == 'L') { init_launcher_panel(p);
M src/util/area.csrc/util/area.c

@@ -140,7 +140,7 @@ // pos changed => redraw

child->posx = pos; child->redraw = 1; } - //printf("level %d, object %d, pos %d\n", level, i, pos); + printf("level %d, object %d, pos %d\n", level, i, pos); size_by_layout(child, pos, level+1);