[nautilus-actions] Fix items loading at startup
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix items loading at startup
- Date: Wed, 19 Jan 2011 21:53:31 +0000 (UTC)
commit 160e715ba947e80d97eea98a2f991d7de8b2de8a
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jan 14 03:05:13 2011 +0100
Fix items loading at startup
+ src/core/na-boxed.c (string_list_from_array, uint_list_from_array):
Do not allocate the empty last element.
+ src/core/na-io-provider.c (load_items_get_merged_list):
+ src/core/na-iprefs.c (na_iprefs_get_io_providers):
Use the correct list pointer.
ChangeLog | 7 +++++++
src/core/na-boxed.c | 20 ++++++++++++++++----
src/core/na-io-provider.c | 4 ++--
src/core/na-iprefs.c | 5 +++--
4 files changed, 28 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4e67859..c9c8667 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,13 @@
* src/utils/nautilus-actions-run.c:
* src/utils/nautilus-actions-schemas.c: Add locale.h include.
+ * src/core/na-boxed.c (string_list_from_array, uint_list_from_array):
+ Do not allocate the empty last element.
+
+ * src/core/na-io-provider.c (load_items_get_merged_list):
+ * src/core/na-iprefs.c (na_iprefs_get_io_providers):
+ Use the correct list pointer.
+
* src/core/na-iprefs.c:
* src/core/na-iprefs.h
(na_iprefs_get_export_format, na_iprefs_set_export_format):
diff --git a/src/core/na-boxed.c b/src/core/na-boxed.c
index 9924d98..67239d8 100644
--- a/src/core/na-boxed.c
+++ b/src/core/na-boxed.c
@@ -710,19 +710,25 @@ string_list_from_string( NABoxed *boxed, const gchar *string )
boxed->is_set = TRUE;
}
+/* do not allocate an empty string for the last element
+ */
static void
string_list_from_array( NABoxed *boxed, const gchar **array )
{
- gchar **i;
+ gchar **i, **next;
if( boxed->is_set ){
string_list_free( boxed );
}
if( array ){
i = ( gchar ** ) array;
+ next = i+1;
while( *i ){
- boxed->u.string_list = g_slist_prepend( boxed->u.string_list, g_strdup( *i ));
+ if( *next ){
+ boxed->u.string_list = g_slist_prepend( boxed->u.string_list, g_strdup( *i ));
+ }
i++;
+ next++;
}
boxed->u.string_list = g_slist_reverse( boxed->u.string_list );
} else {
@@ -892,19 +898,25 @@ uint_list_from_string( NABoxed *boxed, const gchar *string )
boxed->is_set = TRUE;
}
+/* do not allocate an null integer for the last element
+ */
static void
uint_list_from_array( NABoxed *boxed, const gchar **array )
{
- gchar **i;
+ gchar **i, **next;
if( boxed->is_set ){
uint_list_free( boxed );
}
if( array ){
i = ( gchar ** ) array;
+ next = i+1;
while( *i ){
- boxed->u.uint_list = g_list_prepend( boxed->u.uint_list, GINT_TO_POINTER( atoi( *i )));
+ if( *next ){
+ boxed->u.uint_list = g_list_prepend( boxed->u.uint_list, GINT_TO_POINTER( atoi( *i )));
+ }
i++;
+ next++;
}
boxed->u.uint_list = g_list_reverse( boxed->u.uint_list );
} else {
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index 07e0fff..f4675b8 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -938,7 +938,7 @@ load_items_get_merged_list( const NAPivot *pivot, guint loadable_set, GSList **m
providers = na_io_provider_get_io_providers_list( pivot );
for( ip = providers ; ip ; ip = ip->next ){
- provider_object = NA_IO_PROVIDER( it->data );
+ provider_object = NA_IO_PROVIDER( ip->data );
provider_module = provider_object->private->provider;
if( provider_module &&
@@ -960,7 +960,7 @@ load_items_get_merged_list( const NAPivot *pivot, guint loadable_set, GSList **m
}
/*
- * recursively builds the hierarchy
+ * builds the hierarchy
*
* this is a recursive function which _moves_ items from input 'tree' to
* output list.
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index 6d3eab1..42e9f25 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -241,16 +241,17 @@ na_iprefs_get_io_providers( const NAPivot *pivot )
settings = na_pivot_get_settings( pivot );
write_order = na_settings_get_string_list( settings, NA_IPREFS_IO_PROVIDERS_WRITE_ORDER, NULL, NULL );
- for( it = write_order ; it ; it = it->data ){
+ for( it = write_order ; it ; it = it->next ){
name = ( const gchar * ) it->data;
providers = g_slist_prepend( providers, g_strdup( name ));
}
na_core_utils_slist_free( write_order );
groups = na_settings_get_groups( settings );
+
group_prefix = g_strdup_printf( "%s ", NA_IPREFS_IO_PROVIDER_GROUP );
prefix_len = strlen( group_prefix );
- for( it = groups ; it ; it = it->data ){
+ for( it = groups ; it ; it = it->next ){
name = ( const gchar * ) it->data;
if( g_str_has_prefix( name, group_prefix )){
providers = g_slist_prepend( providers, g_strdup( name+prefix_len ));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]