src/gtkutils.c

changeset 5966
91a208b3e979
parent 5959
827dbe4b5bb2
child 5967
df8268ccde45
equal deleted inserted replaced
5965:e1e4161a881d 5966:91a208b3e979
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;

mercurial