src/gtkutils.c

changeset 5967
df8268ccde45
parent 5966
91a208b3e979
child 6236
7c1b45b7ff04
equal deleted inserted replaced
5966:91a208b3e979 5967:df8268ccde45
810 return optmenu; 810 return optmenu;
811 } 811 }
812 812
813 gboolean gaim_gtk_check_if_dir(const char *path, GtkFileSelection *filesel) 813 gboolean gaim_gtk_check_if_dir(const char *path, GtkFileSelection *filesel)
814 { 814 {
815 struct stat st; 815 char *dirname;
816 char *name; 816
817 817 if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
818 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
819 /* append a / if needed */ 818 /* append a / if needed */
820 if (path[strlen(path) - 1] != '/') { 819 if (path[strlen(path) - 1] != '/') {
821 name = g_strconcat(path, "/", NULL); 820 dirname = g_strconcat(path, "/", NULL);
822 } else { 821 } else {
823 name = g_strdup(path); 822 dirname = g_strdup(path);
824 } 823 }
825 gtk_file_selection_set_filename(filesel, name); 824 gtk_file_selection_set_filename(filesel, dirname);
826 g_free(name); 825 g_free(dirname);
827 return TRUE; 826 return TRUE;
828 } 827 }
829 828
830 return FALSE; 829 return FALSE;
831 } 830 }

mercurial