[nautilus] Split the special columns.
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Split the special columns.
- Date: Thu, 13 May 2010 10:33:33 +0000 (UTC)
commit 14dc307c7e76f144d9fbbd091777123867b1efe4
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed May 12 19:52:40 2010 +0200
Split the special columns.
Add utility functions which return a list of columns depending on the
location, separate from the 'common' set which is useful for every
directory.
libnautilus-private/nautilus-column-utilities.c | 73 +++++++++++++++++------
libnautilus-private/nautilus-column-utilities.h | 3 +
2 files changed, 58 insertions(+), 18 deletions(-)
---
diff --git a/libnautilus-private/nautilus-column-utilities.c b/libnautilus-private/nautilus-column-utilities.c
index ddc25ec..b76e625 100644
--- a/libnautilus-private/nautilus-column-utilities.c
+++ b/libnautilus-private/nautilus-column-utilities.c
@@ -128,20 +128,6 @@ get_builtin_columns (void)
/* TODO: Change after string freeze over */
"description", _("Location"),
NULL));
- columns = g_list_append (columns,
- g_object_new (NAUTILUS_TYPE_COLUMN,
- "name", "trashed_on",
- "attribute", "trashed_on",
- "label", _("Trashed On"),
- "description", _("Date when file was moved to the Trash"),
- NULL));
- columns = g_list_append (columns,
- g_object_new (NAUTILUS_TYPE_COLUMN,
- "name", "trash_orig_path",
- "attribute", "trash_orig_path",
- "label", _("Original Location"),
- "description", _("Original location of file before moved to the Trash"),
- NULL));
return columns;
}
@@ -171,20 +157,71 @@ get_extension_columns (void)
return columns;
}
+static GList *
+get_trash_columns (void)
+{
+ static GList *columns = NULL;
+
+ if (columns == NULL) {
+ columns = g_list_append (columns,
+ g_object_new (NAUTILUS_TYPE_COLUMN,
+ "name", "trashed_on",
+ "attribute", "trashed_on",
+ "label", _("Trashed On"),
+ "description", _("Date when file was moved to the Trash"),
+ NULL));
+ columns = g_list_append (columns,
+ g_object_new (NAUTILUS_TYPE_COLUMN,
+ "name", "trash_orig_path",
+ "attribute", "trash_orig_path",
+ "label", _("Original Location"),
+ "description", _("Original location of file before moved to the Trash"),
+ NULL));
+ }
+
+ return nautilus_column_list_copy (columns);
+}
+
GList *
-nautilus_get_all_columns (void)
+nautilus_get_common_columns (void)
{
static GList *columns = NULL;
-
+
if (!columns) {
- columns = g_list_concat (get_builtin_columns (),
- get_extension_columns ());
+ columns = g_list_concat (get_builtin_columns (),
+ get_extension_columns ());
}
return nautilus_column_list_copy (columns);
}
GList *
+nautilus_get_all_columns (void)
+{
+ GList *columns = NULL;
+
+ columns = g_list_concat (nautilus_get_common_columns (),
+ get_trash_columns ());
+
+ return columns;
+}
+
+GList *
+nautilus_get_columns_for_file (NautilusFile *file)
+{
+ GList *columns;
+
+ columns = nautilus_get_common_columns ();
+
+ if (file != NULL && nautilus_file_is_in_trash (file)) {
+ columns = g_list_concat (columns,
+ get_trash_columns ());
+ }
+
+ return columns;
+}
+
+GList *
nautilus_column_list_copy (GList *columns)
{
GList *ret;
diff --git a/libnautilus-private/nautilus-column-utilities.h b/libnautilus-private/nautilus-column-utilities.h
index a830651..f2d92c4 100644
--- a/libnautilus-private/nautilus-column-utilities.h
+++ b/libnautilus-private/nautilus-column-utilities.h
@@ -26,8 +26,11 @@
#define NAUTILUS_COLUMN_UTILITIES_H
#include <libnautilus-extension/nautilus-column.h>
+#include <libnautilus-private/nautilus-file.h>
GList *nautilus_get_all_columns (void);
+GList *nautilus_get_common_columns (void);
+GList *nautilus_get_columns_for_file (NautilusFile *file);
GList *nautilus_column_list_copy (GList *columns);
void nautilus_column_list_free (GList *columns);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]