Mercurial > dwindows
comparison gtk3/dw.c @ 1744:535e8c19a13d
Added dw_filesystem_set_column_title() function to aid in localization.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 04 Jun 2012 22:18:56 +0000 |
parents | cebf830e3da7 |
children | 7dd1659c2693 |
comparison
equal
deleted
inserted
replaced
1743:a297b2bde127 | 1744:535e8c19a13d |
---|---|
5620 { | 5620 { |
5621 return _dw_container_setup(handle, flags, titles, count, separator, 0); | 5621 return _dw_container_setup(handle, flags, titles, count, separator, 0); |
5622 } | 5622 } |
5623 | 5623 |
5624 /* | 5624 /* |
5625 * Configures the main filesystem columnn title for localization. | |
5626 * Parameters: | |
5627 * handle: Handle to the container to be configured. | |
5628 * title: The title to be displayed in the main column. | |
5629 */ | |
5630 void API dw_filesystem_set_column_title(HWND handle, char *title) | |
5631 { | |
5632 char *newtitle = strdup(title ? title : ""); | |
5633 | |
5634 dw_window_set_data(handle, "_dw_coltitle", newtitle); | |
5635 } | |
5636 | |
5637 /* | |
5625 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | 5638 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
5626 * Parameters: | 5639 * Parameters: |
5627 * handle: Handle to the container to be configured. | 5640 * handle: Handle to the container to be configured. |
5628 * flags: An array of unsigned longs with column flags. | 5641 * flags: An array of unsigned longs with column flags. |
5629 * titles: An array of strings with column text titles. | 5642 * titles: An array of strings with column text titles. |
5631 */ | 5644 */ |
5632 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | 5645 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
5633 { | 5646 { |
5634 char **newtitles = malloc(sizeof(char *) * (count + 1)); | 5647 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
5635 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); | 5648 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
5636 | 5649 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); |
5637 newtitles[0] = "Filename"; | 5650 |
5651 newtitles[0] = coltitle ? coltitle : "Filename"; | |
5638 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | 5652 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
5639 | 5653 |
5640 memcpy(&newtitles[1], titles, sizeof(char *) * count); | 5654 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
5641 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); | 5655 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
5642 | 5656 |
5643 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); | 5657 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); |
5644 | 5658 |
5659 if(coltitle) | |
5660 { | |
5661 dw_window_set_data(handle, "_dw_coltitle", NULL); | |
5662 free(coltitle); | |
5663 } | |
5645 if ( newtitles) free(newtitles); | 5664 if ( newtitles) free(newtitles); |
5646 if ( newflags ) free(newflags); | 5665 if ( newflags ) free(newflags); |
5647 return DW_ERROR_NONE; | 5666 return DW_ERROR_NONE; |
5648 } | 5667 } |
5649 | 5668 |