gboolean file_exists_and_is_not_folder;
GFile *parent_file;
GFile *file;
+ gchar *name;
};
static void
else
{
gtk_widget_set_sensitive (priv->new_folder_create_button, TRUE);
- gtk_label_set_text (GTK_LABEL (priv->new_folder_error_label), "");
+
+ // If file doesn't exist, warn if string begins or ends with whitespace
+ if (g_ascii_isspace (data->name[0]))
+ gtk_label_set_text (GTK_LABEL (priv->new_folder_error_label),
+ "Folder names should not begin with a space");
+
+ else if (g_ascii_isspace (data->name[strlen (data->name) - 1]))
+ gtk_label_set_text (GTK_LABEL (priv->new_folder_error_label),
+ "Folder names should not end with a space");
+
+ else
+ gtk_label_set_text (GTK_LABEL (priv->new_folder_error_label), "");
}
out:
g_object_unref (impl);
g_object_unref (data->file);
g_object_unref (data->parent_file);
+ g_free (data->name);
g_free (data);
g_object_unref (cancellable);
}
data->impl = g_object_ref (impl);
data->parent_file = g_object_ref (priv->current_folder);
data->file = g_object_ref (file);
+ data->name = g_strdup(name);
if (priv->file_exists_get_info_cancellable)
g_cancellable_cancel (priv->file_exists_get_info_cancellable);
g_object_unref (data->impl);
g_object_unref (data->file);
g_object_unref (data->parent_file);
+ g_free (data->name);
g_free (data);
g_object_unref (cancellable);
g_object_unref (impl);
g_object_unref (data->file);
g_object_unref (data->parent_file);
+ g_free (data->name);
g_free (data);
}