[nautilus-actions] Load values from schemas default
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Load values from schemas default
- Date: Fri, 9 Apr 2010 07:16:52 +0000 (UTC)
commit a42751098c61f1c53ccb3f1a3c5f1fee18f4f30f
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Apr 8 18:33:49 2010 +0200
Load values from schemas default
When an action has been imported from a schemas file - which was the historical import/export
format -, the values are actually stored as schema defaults, and so the na_gconf_utils_have_entry()
function was inoperant.
ChangeLog | 22 ++++++
TODO | 2 +
src/api/na-core-utils.h | 1 +
src/api/na-gconf-utils.h | 2 +-
src/core/na-core-utils.c | 29 +++++++-
src/core/na-data-boxed.c | 4 +-
src/core/na-gconf-utils.c | 168 +++++++++++++++++++-----------------------
src/core/na-object-action.c | 3 +-
src/core/na-object-id.c | 3 +-
src/io-desktop/nadp-utils.c | 4 +-
src/io-gconf/nagp-reader.c | 36 +++++----
src/nact/base-builder.c | 2 +-
src/nact/nact-iaction-tab.c | 7 ++-
src/nact/nact-icommand-tab.c | 3 +
14 files changed, 167 insertions(+), 119 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d646f9e..f6a8f8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2009-04-08 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-core-utils.h:
+ * src/core/na-core-utils.c (na_core_utils_str_collate): New function.
+
+ * src/core/na-data-boxed.c (locale_are_equal):
+ * src/core/na-object-action.c (deals_with_toolbar_label):
+ * src/core/na-object-id.c (na_object_id_sort_alpha_asc):
+ * src/io-desktop/nadp-utils.c (nadp_utils_gslist_remove_from):
+ * src/nact/base-builder.c (already_loaded): Updated accordingly.
+
+ * src/api/na-gconf-utils.h:
+ * src/core/na-gconf-utils.c (na_gconf_utils_has_entry):
+ Check for an entry in the previously loaded list.
+
+ * src/io-gconf/nagp-reader.c
+ (read_item): First check for Type default value.
+ (read_item, read_done_item_is_writable,
+ read_done_action_load_profile): Load entries.
+
+ * src/nact/nact-iaction-tab.c (on_tab_updatable_selection_changed):
+ * src/nact/nact-icommand-tab.c (on_tab_updatable_selection_changed):
+ Protect gtk_ functions against null values.
+
* src/plugin-menu/Makefile.am:
Rename plugin to libnautilus-actions-menu.
diff --git a/TODO b/TODO
index 733def2..84fdc1c 100644
--- a/TODO
+++ b/TODO
@@ -137,3 +137,5 @@
properties/
conditions/
command/
+
+- gconf_concat_dir_and_key
diff --git a/src/api/na-core-utils.h b/src/api/na-core-utils.h
index 50557b5..7827b3e 100644
--- a/src/api/na-core-utils.h
+++ b/src/api/na-core-utils.h
@@ -48,6 +48,7 @@ gboolean na_core_utils_boolean_from_string( const gchar *string );
/* string manipulation
*/
gchar *na_core_utils_str_add_prefix( const gchar *prefix, const gchar *str );
+int na_core_utils_str_collate( const gchar *str1, const gchar *str2 );
gchar *na_core_utils_str_get_first_word( const gchar *string );
gchar *na_core_utils_str_remove_char( const gchar *string, const gchar *to_remove );
gchar *na_core_utils_str_remove_suffix( const gchar *string, const gchar *suffix );
diff --git a/src/api/na-gconf-utils.h b/src/api/na-gconf-utils.h
index 5d26abf..37984b8 100644
--- a/src/api/na-gconf-utils.h
+++ b/src/api/na-gconf-utils.h
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
GSList *na_gconf_utils_get_subdirs( GConfClient *gconf, const gchar *path );
void na_gconf_utils_free_subdirs( GSList *subdirs );
-gboolean na_gconf_utils_has_entry ( GConfClient *gconf, const gchar *path, const gchar *entry );
+gboolean na_gconf_utils_has_entry ( GSList *entries, const gchar *entry );
GSList *na_gconf_utils_get_entries( GConfClient *gconf, const gchar *path );
gboolean na_gconf_utils_get_bool_from_entries ( GSList *entries, const gchar *entry, gboolean *value );
gboolean na_gconf_utils_get_string_from_entries ( GSList *entries, const gchar *entry, gchar **value );
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 0347592..f987ae8 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -86,6 +86,31 @@ na_core_utils_str_add_prefix( const gchar *prefix, const gchar *str )
}
/**
+ * na_core_utils_str_collate:
+ * @str1: an UTF-8 encoded string.
+ * @str2: an UTF-8 encoded string.
+ *
+ * Returns: -1 if str1 < str2, 0 if str1 = str2, +1 if str1 > str2.
+ */
+int
+na_core_utils_str_collate( const gchar *str1, const gchar *str2 )
+{
+ int res;
+
+ if( str1 && str2 ){
+ res = g_utf8_collate( str1, str2 );
+ } else if( !str1 && !str2 ){
+ res = 0;
+ } else if( !str1 ){
+ res = -1;
+ } else {
+ g_return_val_if_fail( str2 == NULL, 0 );
+ res = 1;
+ }
+ return( res );
+}
+
+/**
* na_core_utils_str_get_first_word:
* @string: a space-separated string.
*
@@ -352,7 +377,7 @@ na_core_utils_slist_remove_utf8( GSList *list, const gchar *str )
for( is = list ; is ; is = is->next ){
const gchar *istr = ( const gchar * ) is->data;
- if( !g_utf8_collate( str, istr )){
+ if( !na_core_utils_str_collate( str, istr )){
g_free( is->data );
list = g_slist_delete_link( list, is );
break;
@@ -409,7 +434,7 @@ na_core_utils_slist_find( GSList *list, const gchar *str )
for( il = list ; il ; il = il->next ){
const gchar *istr = ( const gchar * ) il->data;
- if( !g_utf8_collate( str, istr )){
+ if( !na_core_utils_str_collate( str, istr )){
return( TRUE );
}
}
diff --git a/src/core/na-data-boxed.c b/src/core/na-data-boxed.c
index 85f9a54..44b34ef 100644
--- a/src/core/na-data-boxed.c
+++ b/src/core/na-data-boxed.c
@@ -948,7 +948,7 @@ locale_are_equal( const NADataBoxed *a, const NADataBoxed *b )
if( !a->private->u.string || !b->private->u.string ){
return( FALSE );
}
- return( g_utf8_collate( a->private->u.string, b->private->u.string ) == 0 );
+ return( na_core_utils_str_collate( a->private->u.string, b->private->u.string ) == 0 );
}
static gboolean
@@ -973,7 +973,7 @@ locale_is_set( const NADataBoxed *boxed )
if( boxed->private->u.string && g_utf8_strlen( boxed->private->u.string, -1 )){
if( boxed->private->def->default_value && g_utf8_strlen( boxed->private->def->default_value, -1 )){
- is_set = ( g_utf8_collate( boxed->private->u.string, boxed->private->def->default_value ) != 0 );
+ is_set = ( na_core_utils_str_collate( boxed->private->u.string, boxed->private->def->default_value ) != 0 );
} else {
is_set = TRUE;
}
diff --git a/src/core/na-gconf-utils.c b/src/core/na-gconf-utils.c
index f42e551..bd8fdd6 100644
--- a/src/core/na-gconf-utils.c
+++ b/src/core/na-gconf-utils.c
@@ -81,43 +81,27 @@ na_gconf_utils_free_subdirs( GSList *subdirs )
/**
* na_gconf_utils_has_entry:
- * @gconf: a #GConfClient instance.
- * @path: the full path of a key.
+ * @entries: the list of entries as returned by #na_gconf_utils_get_entries().
* @entry: the entry to be tested.
*
- * Returns: %TRUE if the given @entry exists for the given @path,
+ * Returns: %TRUE if the given @entry exists in the specified @entries,
* %FALSE else.
*/
gboolean
-na_gconf_utils_has_entry( GConfClient *gconf, const gchar *path, const gchar *entry )
+na_gconf_utils_has_entry( GSList *entries, const gchar *entry )
{
- static const gchar *thisfn = "na_gconf_utils_has_entry";
- gboolean have_entry = FALSE;
- GError *error = NULL;
- gchar *key;
- GConfValue *value;
-
- key = g_strdup_printf( "%s/%s", path, entry );
+ GSList *ie;
- value = gconf_client_get_without_default( gconf, key, &error );
-
- if( error ){
- g_warning( "%s: key=%s, error=%s", thisfn, key, error->message );
- g_error_free( error );
- if( value ){
- gconf_value_free( value );
- value = NULL;
+ for( ie = entries ; ie ; ie = ie->next ){
+ gchar *key = g_path_get_basename( gconf_entry_get_key( ( GConfEntry * ) ie->data));
+ int res = strcmp( key, entry );
+ g_free( key );
+ if( res == 0 ){
+ return( TRUE );
}
}
- if( value ){
- have_entry = TRUE;
- gconf_value_free( value );
- }
-
- g_free( key );
-
- return( have_entry );
+ return( FALSE );
}
/**
@@ -309,71 +293,6 @@ na_gconf_utils_free_entries( GSList *list )
}
/**
- * na_gconf_utils_read_string:
- * @gconf: a #GConfClient instance.
- * @path: the full path to the key.
- * @use_schema: whether to use the default value from schema, or not.
- * @default_value: default value to be used if schema is not used or
- * doesn't exist.
- *
- * Returns: the required string value in a newly allocated string which
- * should be g_free() by the caller.
- */
-gchar *
-na_gconf_utils_read_string( GConfClient *gconf, const gchar *path, gboolean use_schema, const gchar *default_value )
-{
- GConfValue *value = NULL;
- gchar *result;
-
- g_return_val_if_fail( GCONF_IS_CLIENT( gconf ), NULL );
-
- result = g_strdup( default_value );
-
- value = read_value( gconf, path, use_schema, GCONF_VALUE_STRING );
-
- if( value ){
- g_free( result );
- result = g_strdup( gconf_value_get_string( value ));
- gconf_value_free( value );
- }
-
- return( result );
-}
-
-static GConfValue *
-read_value( GConfClient *gconf, const gchar *path, gboolean use_schema, GConfValueType type )
-{
- static const gchar *thisfn = "na_gconf_utils_read_value";
- GError *error = NULL;
- GConfValue *value = NULL;
-
- if( use_schema ){
- value = gconf_client_get( gconf, path, &error );
- } else {
- value = gconf_client_get_without_default( gconf, path, &error );
- }
-
- if( error ){
- g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
- g_error_free( error );
- if( value ){
- gconf_value_free( value );
- value = NULL;
- }
- }
-
- if( value ){
- if( value->type != type ){
- g_warning( "%s: path=%s, found type '%u' while waiting for type '%u'", thisfn, path, value->type, type );
- gconf_value_free( value );
- value = NULL;
- }
- }
-
- return( value );
-}
-
-/**
* na_gconf_utils_read_bool:
* @gconf: a #GConfClient instance.
* @path: the full path to the key.
@@ -433,6 +352,38 @@ na_gconf_utils_read_int( GConfClient *gconf, const gchar *path, gboolean use_sch
}
/**
+ * na_gconf_utils_read_string:
+ * @gconf: a #GConfClient instance.
+ * @path: the full path to the key.
+ * @use_schema: whether to use the default value from schema, or not.
+ * @default_value: default value to be used if schema is not used or
+ * doesn't exist.
+ *
+ * Returns: the required string value in a newly allocated string which
+ * should be g_free() by the caller.
+ */
+gchar *
+na_gconf_utils_read_string( GConfClient *gconf, const gchar *path, gboolean use_schema, const gchar *default_value )
+{
+ GConfValue *value = NULL;
+ gchar *result;
+
+ g_return_val_if_fail( GCONF_IS_CLIENT( gconf ), NULL );
+
+ result = g_strdup( default_value );
+
+ value = read_value( gconf, path, use_schema, GCONF_VALUE_STRING );
+
+ if( value ){
+ g_free( result );
+ result = g_strdup( gconf_value_get_string( value ));
+ gconf_value_free( value );
+ }
+
+ return( result );
+}
+
+/**
* na_gconf_utils_read_string_list:
* @gconf: a #GConfClient instance.
* @path: the full path to the key to be read.
@@ -705,6 +656,39 @@ na_gconf_utils_slist_to_string( GSList *slist )
return( g_string_free( str, FALSE ));
}
+static GConfValue *
+read_value( GConfClient *gconf, const gchar *path, gboolean use_schema, GConfValueType type )
+{
+ static const gchar *thisfn = "na_gconf_utils_read_value";
+ GError *error = NULL;
+ GConfValue *value = NULL;
+
+ if( use_schema ){
+ value = gconf_client_get( gconf, path, &error );
+ } else {
+ value = gconf_client_get_without_default( gconf, path, &error );
+ }
+
+ if( error ){
+ g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
+ g_error_free( error );
+ if( value ){
+ gconf_value_free( value );
+ value = NULL;
+ }
+ }
+
+ if( value ){
+ if( value->type != type ){
+ g_warning( "%s: path=%s, found type '%u' while waiting for type '%u'", thisfn, path, value->type, type );
+ gconf_value_free( value );
+ value = NULL;
+ }
+ }
+
+ return( value );
+}
+
static gboolean
sync_gconf( GConfClient *gconf, gchar **message )
{
diff --git a/src/core/na-object-action.c b/src/core/na-object-action.c
index 33a5842..6edfe77 100644
--- a/src/core/na-object-action.c
+++ b/src/core/na-object-action.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
+#include <api/na-core-utils.h>
#include <api/na-iio-provider.h>
#include <api/na-object-api.h>
@@ -457,7 +458,7 @@ deals_with_toolbar_label( NAIFactoryObject *instance )
na_object_set_toolbar_same_label( instance, TRUE );
} else {
- same_label = ( g_utf8_collate( action_label, toolbar_label ) == 0 );
+ same_label = ( na_core_utils_str_collate( action_label, toolbar_label ) == 0 );
na_object_set_toolbar_same_label( instance, same_label );
}
diff --git a/src/core/na-object-id.c b/src/core/na-object-id.c
index 1f4afdc..c49546a 100644
--- a/src/core/na-object-id.c
+++ b/src/core/na-object-id.c
@@ -34,6 +34,7 @@
#include <glib/gi18n.h>
+#include <api/na-core-utils.h>
#include <api/na-object-api.h>
/* private class data
@@ -235,7 +236,7 @@ na_object_id_sort_alpha_asc( const NAObjectId *a, const NAObjectId *b )
label_a = na_object_get_label( a );
label_b = na_object_get_label( b );
- compare = g_utf8_collate( label_a, label_b );
+ compare = na_core_utils_str_collate( label_a, label_b );
g_free( label_b );
g_free( label_a );
diff --git a/src/io-desktop/nadp-utils.c b/src/io-desktop/nadp-utils.c
index 4820117..24e4ff4 100644
--- a/src/io-desktop/nadp-utils.c
+++ b/src/io-desktop/nadp-utils.c
@@ -37,6 +37,8 @@
#include <glib/gstdio.h>
#include <uuid/uuid.h>
+#include <api/na-core-utils.h>
+
#include "nadp-desktop-provider.h"
#include "nadp-utils.h"
@@ -54,7 +56,7 @@ nadp_utils_gslist_remove_from( GSList *list, const gchar *string )
for( is = list ; is ; is = is->next ){
const gchar *istr = ( const gchar * ) is->data;
- if( !g_utf8_collate( string, istr )){
+ if( !na_core_utils_str_collate( string, istr )){
g_free( is->data );
list = g_slist_delete_link( list, is );
break;
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index 02c56da..83d443f 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -48,6 +48,7 @@
typedef struct {
gchar *path;
+ GSList *entries;
NAObjectItem *parent;
}
ReaderData;
@@ -111,7 +112,6 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
{
static const gchar *thisfn = "nagp_gconf_provider_read_item";
NAObjectItem *item;
- gboolean have_type;
gchar *full_path;
gchar *type;
gchar *id;
@@ -122,22 +122,19 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
g_return_val_if_fail( NA_IS_IIO_PROVIDER( provider ), NULL );
g_return_val_if_fail( !provider->private->dispose_has_run, NULL );
- have_type = na_gconf_utils_has_entry( provider->private->gconf, path, NAGP_ENTRY_TYPE );
full_path = gconf_concat_dir_and_key( path, NAGP_ENTRY_TYPE );
type = na_gconf_utils_read_string( provider->private->gconf, full_path, TRUE, NAGP_VALUE_TYPE_ACTION );
g_free( full_path );
item = NULL;
- /* a menu has a type='Menu'
+ /* a menu may have 'Action' or 'Menu' type ; defaults to Action
*/
- if( have_type && !strcmp( type, NAGP_VALUE_TYPE_MENU )){
- item = NA_OBJECT_ITEM( na_object_menu_new());
-
- /* else this should be an action (no type, or type='Action')
- */
- } else if( !have_type || !strcmp( type, NAGP_VALUE_TYPE_ACTION )){
+ if( !type || !strlen( type ) || !strcmp( type, NAGP_VALUE_TYPE_ACTION )){
item = NA_OBJECT_ITEM( na_object_action_new());
+ } else if( !strcmp( type, NAGP_VALUE_TYPE_MENU )){
+ item = NA_OBJECT_ITEM( na_object_menu_new());
+
} else {
g_warning( "%s: unknown type '%s' at %s", thisfn, type, path );
}
@@ -151,6 +148,7 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
data = g_new0( ReaderData, 1 );
data->path = ( gchar * ) path;
+ data->entries = na_gconf_utils_get_entries( provider->private->gconf, path );
na_ifactory_provider_read_item(
NA_IFACTORY_PROVIDER( provider ),
@@ -158,6 +156,7 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
NA_IFACTORY_OBJECT( item ),
messages );
+ na_gconf_utils_free_entries( data->entries );
g_free( data );
}
@@ -223,17 +222,16 @@ nagp_reader_read_done( const NAIFactoryProvider *provider, void *reader_data, co
static void
read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *item, ReaderData *data, GSList **messages )
{
- GSList *entries, *ie;
+ GSList *ie;
gboolean writable;
GConfEntry *gconf_entry;
const gchar *key;
/* check for writability of this item
+ * item is writable if and only if all entries are themselves writable
*/
- entries = na_gconf_utils_get_entries( NAGP_GCONF_PROVIDER( provider )->private->gconf, data->path );
-
writable = TRUE;
- for( ie = entries ; ie && writable ; ie = ie->next ){
+ for( ie = data->entries ; ie && writable ; ie = ie->next ){
gconf_entry = ( GConfEntry * ) ie->data;
key = gconf_entry_get_key( gconf_entry );
writable = is_key_writable( NAGP_GCONF_PROVIDER( provider ), key );
@@ -289,6 +287,7 @@ read_done_action_load_profile( const NAIFactoryProvider *provider, ReaderData *d
profile_data = g_new0( ReaderData, 1 );
profile_data->parent = data->parent;
profile_data->path = ( gchar * ) path;
+ profile_data->entries = na_gconf_utils_get_entries( NAGP_GCONF_PROVIDER( provider )->private->gconf, path );
na_ifactory_provider_read_item(
NA_IFACTORY_PROVIDER( provider ),
@@ -296,6 +295,7 @@ read_done_action_load_profile( const NAIFactoryProvider *provider, ReaderData *d
NA_IFACTORY_OBJECT( profile ),
messages );
+ na_gconf_utils_free_entries( profile_data->entries );
g_free( profile_data );
}
@@ -317,7 +317,8 @@ get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, Reade
gint int_value;
boxed = NULL;
- have_entry = na_gconf_utils_has_entry( provider->private->gconf, path, def->gconf_entry );
+ have_entry = na_gconf_utils_has_entry( reader_data->entries, def->gconf_entry );
+ g_debug( "%s: entry=%s, have_entry=%s", thisfn, def->gconf_entry, have_entry ? "True":"False" );
if( have_entry ){
boxed = na_data_boxed_new( def );
@@ -327,13 +328,14 @@ get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, Reade
case NAFD_TYPE_STRING:
case NAFD_TYPE_LOCALE_STRING:
- str_value = na_gconf_utils_read_string( provider->private->gconf, entry_path, FALSE, NULL );
+ str_value = na_gconf_utils_read_string( provider->private->gconf, entry_path, TRUE, NULL );
+ g_debug( "%s: entry=%s, value=%s", thisfn, def->gconf_entry, str_value );
na_data_boxed_set_from_string( boxed, str_value );
g_free( str_value );
break;
case NAFD_TYPE_BOOLEAN:
- bool_value = na_gconf_utils_read_bool( provider->private->gconf, entry_path, FALSE, FALSE );
+ bool_value = na_gconf_utils_read_bool( provider->private->gconf, entry_path, TRUE, FALSE );
na_data_boxed_set_from_void( boxed, GUINT_TO_POINTER( bool_value ));
break;
@@ -344,7 +346,7 @@ get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, Reade
break;
case NAFD_TYPE_UINT:
- int_value = na_gconf_utils_read_int( provider->private->gconf, entry_path, FALSE, 0 );
+ int_value = na_gconf_utils_read_int( provider->private->gconf, entry_path, TRUE, 0 );
na_data_boxed_set_from_void( boxed, GUINT_TO_POINTER( int_value ));
break;
diff --git a/src/nact/base-builder.c b/src/nact/base-builder.c
index e0c2c24..ab8ad86 100644
--- a/src/nact/base-builder.c
+++ b/src/nact/base-builder.c
@@ -265,7 +265,7 @@ already_loaded( BaseBuilder *builder, const gchar *filename )
GSList *it;
for( it = builder->private->fnames ; it && !loaded ; it = it->next ){
- if( !g_utf8_collate(( const gchar * ) it->data, filename )){
+ if( !na_core_utils_str_collate(( const gchar * ) it->data, filename )){
loaded = TRUE;
}
}
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 7de8ecd..644d686 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -35,6 +35,7 @@
#include <glib/gi18n.h>
#include <string.h>
+#include <api/na-core-utils.h>
#include <api/na-object-api.h>
#include <core/na-io-provider.h>
@@ -463,6 +464,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection || target_location ));
label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
label = item ? na_object_get_label( item ) : g_strdup( "" );
+ label = label ? label : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
if( item ){
check_for_label( instance, GTK_ENTRY( label_widget ), label );
@@ -484,6 +486,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionToolbarLabelEntry" );
label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_get_toolbar_label( item ) : g_strdup( "" );
+ label = label ? label : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
g_free( label );
toolbar_label_set_sensitive( instance, item );
@@ -491,6 +494,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
+ tooltip = tooltip ? tooltip : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
g_free( tooltip );
gtk_widget_set_sensitive( tooltip_widget, item != NULL );
@@ -498,6 +502,7 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
icon = item ? na_object_get_icon( item ) : g_strdup( "" );
+ icon = icon ? icon : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
g_free( icon );
gtk_widget_set_sensitive( icon_widget, item != NULL );
@@ -1007,7 +1012,7 @@ sort_stock_ids( gconstpointer a, gconstpointer b )
} else {
label_a = strip_underscore( stock_item_a.label );
label_b = strip_underscore( stock_item_b.label );
- retv = g_utf8_collate( label_a, label_b );
+ retv = na_core_utils_str_collate( label_a, label_b );
g_free( label_a );
g_free( label_b );
}
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index d952b06..2c2a294 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -340,6 +340,7 @@ on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_select
label_entry = get_label_entry( instance );
label = profile ? na_object_get_label( profile ) : g_strdup( "" );
+ label = label ? label : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
check_for_label( instance, GTK_ENTRY( label_entry ), label );
g_free( label );
@@ -348,6 +349,7 @@ on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_select
path_entry = get_path_entry( instance );
path = profile ? na_object_get_path( profile ) : g_strdup( "" );
+ path = path ? path : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
g_free( path );
gtk_widget_set_sensitive( path_entry, profile != NULL );
@@ -359,6 +361,7 @@ on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_select
parameters_entry = get_parameters_entry( instance );
parameters = profile ? na_object_get_parameters( profile ) : g_strdup( "" );
+ parameters = parameters ? parameters : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
g_free( parameters );
gtk_widget_set_sensitive( parameters_entry, profile != NULL );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]