Mercurial > dwindows
comparison gtk/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 | fae374a0055b |
children | f297d8a63aed |
comparison
equal
deleted
inserted
replaced
1743:a297b2bde127 | 1744:535e8c19a13d |
---|---|
6912 { | 6912 { |
6913 return _dw_container_setup(handle, flags, titles, count, separator, 0); | 6913 return _dw_container_setup(handle, flags, titles, count, separator, 0); |
6914 } | 6914 } |
6915 | 6915 |
6916 /* | 6916 /* |
6917 * Configures the main filesystem columnn title for localization. | |
6918 * Parameters: | |
6919 * handle: Handle to the container to be configured. | |
6920 * title: The title to be displayed in the main column. | |
6921 */ | |
6922 void API dw_filesystem_set_column_title(HWND handle, char *title) | |
6923 { | |
6924 char *newtitle = strdup(title ? title : ""); | |
6925 | |
6926 dw_window_set_data(handle, "_dw_coltitle", newtitle); | |
6927 } | |
6928 | |
6929 /* | |
6917 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | 6930 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
6918 * Parameters: | 6931 * Parameters: |
6919 * handle: Handle to the container to be configured. | 6932 * handle: Handle to the container to be configured. |
6920 * flags: An array of unsigned longs with column flags. | 6933 * flags: An array of unsigned longs with column flags. |
6921 * titles: An array of strings with column text titles. | 6934 * titles: An array of strings with column text titles. |
6923 */ | 6936 */ |
6924 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | 6937 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
6925 { | 6938 { |
6926 char **newtitles = malloc(sizeof(char *) * (count + 1)); | 6939 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
6927 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); | 6940 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
6941 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); | |
6928 int res; | 6942 int res; |
6929 | 6943 |
6930 newtitles[0] = "Filename"; | 6944 newtitles[0] = coltitle ? coltitle : "Filename"; |
6931 | 6945 |
6932 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | 6946 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
6933 | 6947 |
6934 memcpy(&newtitles[1], titles, sizeof(char *) * count); | 6948 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
6935 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); | 6949 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
6936 | 6950 |
6937 res = _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); | 6951 res = _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); |
6938 | 6952 |
6953 if(coltitle) | |
6954 { | |
6955 dw_window_set_data(handle, "_dw_coltitle", NULL); | |
6956 free(coltitle); | |
6957 } | |
6939 if ( newtitles) free(newtitles); | 6958 if ( newtitles) free(newtitles); |
6940 if ( newflags ) free(newflags); | 6959 if ( newflags ) free(newflags); |
6941 return res; | 6960 return res; |
6942 } | 6961 } |
6943 | 6962 |