Unix Software Development: Assignment 3
For this assignment, you are to implement a file browser, providing a graphical user interface through GTK+3.0. Your assignments will be evaluated on correct functionality and conformance to the coding standards described at the end of this assignment specification. The File Browser
The file browser must have three resizable panes, organized as shown below.
The left pane (the “file system view”) must provide a hierarchical view of the file system of the computer on which it is running.
The top-right pane (the “directory view”) must list the files in whichever directory is selected in the file system view.
The bottom-right pane must contain a hexadecimal view of the data in whatever file is selected in the directory view.
Each of the panes must provide vertical and horizontal scrollbars whenever needed to display their contents.
The File System View
The File System view must show the hierarchy of directories in the file system, starting with the root directory or the user’s home directory.
Except when displaying the root directory, the file system view must contain an entry for “..”, the parent directory of the currently displayed directory.
Selection of a directory in this view must result in display, in the directory view, of the list of files and subdirectories of the selected directory.
The Directory View
The Directory view must list the files and subdirectories in the directory selected in the File System view. For each file display information in sortable columns:
1. An icon representing the file type with its name.
2. The size in bytes.
3. The last modification date and time.
4. (This column should not be sortable) The access permissions for the owner, group and other users, displayed in rwx form, as in the Unix ls –l command.
The Directory view must be sortable on any of the first three columns. Selection of a file from the directory view must result in display of the contents of that file in the hexadecimal viewer.
The Hexadecimal Viewer
The hexadecimal viewer shall display the raw byte values from the file in hexadecimal notation, in rows of 16 bytes per row. The display is to be in three parts:
1. The leftmost part shows the start address of the row (its offset, in bytes, from the start of the file), in hexadecimal
2. The central part shows the value of each byte in two hexadecimal digits. Pairs of hexadecimal digits are to be separated by a single space.
3. The rightmost part shall show the character representation of the bytes in the row; for those bytes that do not have a printable representation, display a dot.
Saving your files in a zipped tar file You need to submit all your C and header files and a makefile that can be used to compile and link your programs. First you need to bundle them up into a single tar file. The term “tar” is an abbreviation of “tape archive” and goes back to the days when people would save a back-up copy of their files on magnetic tape. Nowadays, with the price of large disk drives so low, nobody uses tape anymore, but the concept of tar files survives. 1. Use the command: tar -cf WnnnnnnnnAssg1.tar *.c *.h Makefile (where Wnnnnnnnn is your W-number). The -cf specifies two options for the tar command: ‘c’ means create and ‘f’ means that the name of the resulting tar file comes next in the command. Following the name of the tar file, we list the files to be included in the tar file. In this case, we want all the files in your current directory whose names end with “.c” or “.h”. 2. If you now use the command ls you should now see the file WnnnnnnnnAssg1.tar in your directory. 3. If you use the command tar -tf WnnnnnnnnAssg1.tar (where Wnnnnnnnn is your W-number), it will list the files within the tar file. 4. Now compress the tar file using the gzip program: gzip WnnnnnnnnAssg1.tar 5. By using the ls command again, you should see the file WnnnnnnnnAssg1.tar.gz in your directory. This is the file that you need to submit through the Assignment 1 Submission link in the course web site. Coding Standards 1. Use meaningful names that give the reader a clue as to the purpose of the thing being named.
2. Avoid the repeated use of numeric constants. For any numeric constants used in your program, use #define preprocessor directives to define a macro name and then use that name wherever the value is needed. 3. Use comments at the start of the program to identify the purpose of the program, the author and the date written. 4. Use comments at the start of each function to describe the purpose of the function, the purpose of each parameter to the function, and the return value from the function. 5. Use comments at the start of each section of the program to explain what that part of the program does. 6. Use consistent indentation.