diff -Naur wmdrawer-0.10.5.orig/config.c wmdrawer-0.10.5/config.c --- wmdrawer-0.10.5.orig/config.c 2004-06-26 22:24:12 +0400 +++ wmdrawer-0.10.5/config.c 2004-08-08 15:44:30 +0400 @@ -33,6 +33,7 @@ static void parseLine (char *line, int line_num); static void usage (void); static void freeUnusedMemory (void); +void CreateConfig(char *file); enum section { general, @@ -99,7 +100,8 @@ } if ((f = fopen (configFilePath, "r")) == NULL) { printf ("%s error: can't open config file %s\n", PACKAGE, configFilePath); - exit (EXIT_FAILURE); + CreateConfig (configFilePath); + f = fopen(configFilePath, "r"); } if (stat (configFilePath, &buf) == 0) { @@ -665,3 +667,121 @@ free (config.entries); config.entries = NULL; } + +void CreateConfig(char *file) + { + FILE *fp; + fp = fopen(file,"w+"); + if(!fp) + { + printf("Can't open file!\n"); + exit(EXIT_FAILURE); + } + /* Uglu, ugly hack :( */ + fprintf(fp,"# Config file example for wmdrawer\n"); + fprintf(fp,"[general]\n"); + fprintf(fp,"# Dock's icon [optional]\n"); + fprintf(fp,"#dock_icon panel-drawer.png\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Drawer's opening direction [required]\n"); + fprintf(fp,"# Top to bottom = 0\n"); + fprintf(fp,"# Right to Left = 1\n"); + fprintf(fp,"# Bottom to Top = 2\n"); + fprintf(fp,"# Left to Right = 3\n"); + fprintf(fp,"direction 2\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Image used for icons' background [optional]\n"); + fprintf(fp,"#icons_bg defaultTile.xpm\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Allow icons' enlargement to fit them to buttons' size [optional, default 1]\n"); + fprintf(fp,"# 0 indicate that icons should never be larger than their original size.\n"); + fprintf(fp,"#icons_expand 1\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Activate the drawer's pseudo-transparency [optional, default 0]\n"); + fprintf(fp,"# if you choose transparency, icons_bg will be ignored\n"); + fprintf(fp,"#transparency 0\n"); + fprintf(fp,"\n"); + fprintf(fp,"# dock's width: min=12, max=128 [optional, default=64]\n"); + fprintf(fp,"#dock_width 64\n"); + fprintf(fp,"\n"); + fprintf(fp,"# dock's height: min=12, max=128 [optional, default=64]\n"); + fprintf(fp,"#dock_height 64\n"); + fprintf(fp,"\n"); + fprintf(fp,"# buttons' size: min=12, max=128 [optional]\n"); + fprintf(fp,"# Useful for the people who want for example to have big icons\n"); + fprintf(fp,"# and to define several columns.\n"); + fprintf(fp,"#btns_size 32\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Icon's highlight type: 0, 1 or 2 [optional, default 2]\n"); + fprintf(fp,"# 0 : no highlight\n"); + fprintf(fp,"# 1 : target (unavailable if transparency is activated)\n"); + fprintf(fp,"# 2 : shading\n"); + fprintf(fp,"#highlight 2\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Image used as highlight [optional]\n"); + fprintf(fp,"# only used if you choice target type\n"); + fprintf(fp,"#highlight_img highlight.xpm\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Tint icons by a specified color [optional, default #ffffff]\n"); + fprintf(fp,"# only used if you choice shading type\n"); + fprintf(fp,"#highlight_tint #ffffff\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Shade icons at a specified level [optional, default 60]\n"); + fprintf(fp,"# only used if you choice shading type\n"); + fprintf(fp,"#highlight_sh 60\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Display buttons' tooltips [optional, default 1]\n"); + fprintf(fp,"#tooltips 1\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Tooltips' font [optional, default fixed]\n"); + fprintf(fp,"#tooltips_font fixed\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Drawer's animation speed: 0, 1, 2, 3, 4 [optional, default 1]\n"); + fprintf(fp,"#animation_speed 1\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Mouse cursor in drawer: 0, 1, ..., 76 [optional, default 30]\n"); + fprintf(fp,"#cursor 30\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Auto opening of the drawer: 0, 1 [optional, default 0]\n"); + fprintf(fp,"#show_on_hover 0\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Auto closing of the drawer: 0, 1 [optional, default 0]\n"); + fprintf(fp,"#hide_on_out 0\n"); + fprintf(fp,"\n"); + fprintf(fp,"# drawer's hiding timeout in miliseconds [optional, default 1000]\n"); + fprintf(fp,"#hide_timeout 1000\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Runs the dockapp in windowed mode: 0, 1 [optional, default 0]\n"); + fprintf(fp,"# Useful for AfterStep, Fvwm, Sawfish or KDE users.\n"); + fprintf(fp,"#windowed_mode 0\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Instance name so window manager can distinguish between multiple copies\n"); + fprintf(fp,"#instance_name distinguish_name\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Drawer's border size in pixels [optional, default 1]\n"); + fprintf(fp,"#border_size 1\n"); + fprintf(fp,"\n"); + fprintf(fp,"# Images directories\n"); + fprintf(fp,"[images_paths]\n"); + fprintf(fp,"/usr/share/pixmaps\n"); + fprintf(fp,"/usr/local/share/pixmaps/\n"); + fprintf(fp,"\n"); + fprintf(fp,"# A first column with 5 buttons\n"); + fprintf(fp,"# Each button must be defined with this syntax:\n"); + fprintf(fp,"# (tooltip) (image) (command)\n"); + fprintf(fp,"[column]\n"); + fprintf(fp,"(X Terminal) (gnome-term.png) (xterm -bg black -fg wheat)\n"); + fprintf(fp,"(Galeon) (galeon.xpm) (galeon -s)\n"); + fprintf(fp,"(Sylpheed) (sylpheed.png) (sylpheed)\n"); + fprintf(fp,"(XChat) (xchat.png) (xchat)\n"); + fprintf(fp,"(MPlayer) (gnome-multimedia.png) (mplayer)\n"); + fprintf(fp,"\n"); + fprintf(fp,"# A second column with 5 buttons\n"); + fprintf(fp,"[column]\n"); + fprintf(fp,"(Xmms) (gnome-audio2.png) (xmms)\n"); + fprintf(fp,"(Gimp) (gnome-gimp.png) (gimp)\n"); + fprintf(fp,"(GQview) (gqview.png) (gqview)\n"); + fprintf(fp,"(Xcalc) (gnome-calc3.png) (xcalc)\n"); + fprintf(fp,"(GFtp) (gftp.png) (gftp)\n"); + fclose(fp); + }