comparison src/gtkutils.c @ 5966:5fb6bd688a5b

[gaim-migrate @ 6413] I renamed file_is_dir to gaim_gtk_check_if_dir and moved it to gtkutils.c/h Chipster (or whoever) - Lemme know if that's notsogood, remember: I pretend not to know anything about gtk. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 27 Jun 2003 23:11:21 +0000
parents 0a2a32b1917c
children 156953fe3e14
comparison
equal deleted inserted replaced
5965:cd8f8e5d697e 5966:5fb6bd688a5b
263 gtkconv = GAIM_GTK_CONVERSATION(c); 263 gtkconv = GAIM_GTK_CONVERSATION(c);
264 264
265 f = gtk_file_selection_get_filename( 265 f = gtk_file_selection_get_filename(
266 GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); 266 GTK_FILE_SELECTION(gtkconv->u.im->save_icon));
267 267
268 if (file_is_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon))) 268 if (gaim_gtk_check_if_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon)))
269 return; 269 return;
270 270
271 if ((file = fopen(f, "w")) != NULL) { 271 if ((file = fopen(f, "w")) != NULL) {
272 int len; 272 int len;
273 void *data = get_icon_data(gaim_conversation_get_gc(c), 273 void *data = get_icon_data(gaim_conversation_get_gc(c),
806 G_CALLBACK(account_menu_cb), cb); 806 G_CALLBACK(account_menu_cb), cb);
807 807
808 g_object_unref(sg); 808 g_object_unref(sg);
809 809
810 return optmenu; 810 return optmenu;
811 }
812
813 gboolean gaim_gtk_check_if_dir(const char *path, GtkFileSelection *filesel)
814 {
815 struct stat st;
816 char *name;
817
818 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
819 /* append a / if needed */
820 if (path[strlen(path) - 1] != '/') {
821 name = g_strconcat(path, "/", NULL);
822 } else {
823 name = g_strdup(path);
824 }
825 gtk_file_selection_set_filename(filesel, name);
826 g_free(name);
827 return TRUE;
828 }
829
830 return FALSE;
811 } 831 }
812 832
813 char *stylize(const gchar *text, int length) 833 char *stylize(const gchar *text, int length)
814 { 834 {
815 gchar *buf; 835 gchar *buf;