141 |
static void |
static void |
142 |
set_path (gchar * pathstr) |
set_path (gchar * pathstr) |
143 |
{ |
{ |
|
gchar *str, *fpathstr; |
|
|
GString *path; |
|
|
|
|
144 |
if (strlen (pathstr) > 0) |
if (strlen (pathstr) > 0) |
145 |
{ |
{ |
146 |
path = g_string_new (pathstr); |
if (g_ascii_strcasecmp (preferences.savedir, pathstr)) |
147 |
str = g_strdup (path->str); |
preferences.savedir = g_strdup (pathstr); |
|
/* remove trailing slash */ |
|
|
g_strreverse (str); |
|
|
if (!g_ascii_strncasecmp (str, "/", 1)) |
|
|
{ |
|
|
path = g_string_erase (path, (path->len) - 1, 1); |
|
|
} |
|
|
else /* in case a file is selected */ |
|
|
{ |
|
|
fpathstr = g_strdup (path->str); |
|
|
path = g_string_new (dirname (fpathstr)); |
|
|
g_free (fpathstr); |
|
|
} |
|
|
g_free (str); |
|
|
if (g_ascii_strcasecmp (preferences.savedir, path->str)) |
|
|
preferences.savedir = g_strdup (path->str); |
|
|
g_string_free (path, TRUE); |
|
148 |
} |
} |
149 |
} |
} |
150 |
|
|
668 |
GtkWidget *pathselection; |
GtkWidget *pathselection; |
669 |
|
|
670 |
pathselection = create_pathselection (); |
pathselection = create_pathselection (); |
671 |
gtk_editable_set_editable (GTK_EDITABLE |
gtk_editable_set_editable (GTK_EDITABLE |
672 |
(GTK_FILE_SELECTION (pathselection)-> |
(GTK_FILE_SELECTION (pathselection)-> selection_entry), FALSE); |
673 |
selection_entry), FALSE); |
gtk_widget_set_sensitive |
674 |
|
(GTK_FILE_SELECTION (pathselection)->file_list, FALSE); |
675 |
|
|
676 |
gtk_widget_set_sensitive (preferencesdialog, 0); |
gtk_widget_set_sensitive (preferencesdialog, 0); |
677 |
gtk_widget_show (pathselection); |
gtk_widget_show (pathselection); |
678 |
} |
} |