new ibar sources now try to copy default source before writing dummy source

SVN revision: 79684
This commit is contained in:
Mike Blumenkrantz 2012-11-26 09:59:44 +00:00
parent d8edcec5f1
commit 2d1f1ba0d0
1 changed files with 16 additions and 15 deletions

View File

@ -220,30 +220,31 @@ static void
_cb_entry_ok(void *data, char *text)
{
char buf[4096];
char tmp[4096];
char tmp[4096] = {0};
FILE *f;
size_t len;
len = e_user_dir_snprintf(buf, sizeof(buf), "applications/bar/%s", text);
if (len + sizeof("/.order") >= sizeof(buf)) return;
if (!ecore_file_exists(buf))
while (!ecore_file_exists(buf))
{
ecore_file_mkdir(buf);
memcpy(buf + len, "/.order", sizeof("/.order"));
e_user_dir_concat_static(tmp, "applications/bar/default/.order");
if (ecore_file_cp(tmp, buf)) break;
f = fopen(buf, "w");
if (f)
{
/* Populate this .order file with some defaults */
snprintf(tmp, sizeof(tmp),
"terminology.desktop\n"
"sylpheed.desktop\n"
"firefox.desktop\n"
"openoffice.desktop\n"
"xchat.desktop\n"
"gimp.desktop\n");
fwrite(tmp, sizeof(char), strlen(tmp), f);
fclose(f);
}
if (!f) break;
/* Populate this .order file with some defaults */
snprintf(tmp, sizeof(tmp),
"terminology.desktop\n"
"sylpheed.desktop\n"
"firefox.desktop\n"
"openoffice.desktop\n"
"xchat.desktop\n"
"gimp.desktop\n");
fwrite(tmp, sizeof(char), strlen(tmp), f);
fclose(f);
break;
}
_load_tlist(data);