[nautilus-actions] Fix bad interface inheritance
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix bad interface inheritance
- Date: Fri, 19 Feb 2010 02:30:18 +0000 (UTC)
commit 3a095049f5424d446bea235c07dba6153e69eb2d
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Feb 18 19:32:51 2010 +0100
Fix bad interface inheritance
ChangeLog | 18 ++++++++++++++++++
src/api/na-core-utils.h | 2 +-
src/core/na-core-utils.c | 14 +++++++-------
src/io-desktop/nadp-desktop-file.c | 24 +++++++++++-------------
src/io-desktop/nadp-desktop-provider.c | 10 +++++++---
src/io-desktop/nadp-xdg-dirs.c | 2 +-
src/nact/base-iprefs.c | 2 +-
src/nact/base-iprefs.h | 4 +---
src/nact/nact-assistant-import.c | 1 +
src/nact/nact-icommand-tab.c | 2 ++
src/nact/nact-import-ask.c | 2 ++
src/nact/nact-iprefs.c | 4 +++-
src/nact/nact-iprefs.h | 4 +---
src/nact/nact-main-toolbar.c | 2 ++
src/nact/nact-preferences-editor.c | 2 ++
15 files changed, 60 insertions(+), 33 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38b01e8..eca4c10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2009-02-18 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-core-utils.h:
+ * src/core/na-core-utils.c:
+ * src/io-desktop/nadp-desktop-file.c:
+ * src/io-desktop/nadp-desktop-provider.c:
+ * src/io-desktop/nadp-xdg-dirs.c:
+ Fix reading of localized values in the desktop file.
+
+ * src/nact/base-iprefs.c:
+ * src/nact/base-iprefs.h:
+ * src/nact/nact-assistant-import.c:
+ * src/nact/nact-icommand-tab.c:
+ * src/nact/nact-import-ask.c:
+ * src/nact/nact-iprefs.c:
+ * src/nact/nact-iprefs.h:
+ * src/nact/nact-main-toolbar.c:
+ * src/nact/nact-preferences-editor.c:
+ Fix bad inheritance of interfaces.
+
* src/api/na-object-api.h:
* src/api/na-object.h:
* src/core/na-data-factory.c:
diff --git a/src/api/na-core-utils.h b/src/api/na-core-utils.h
index 0ba7e40..0cf5b31 100644
--- a/src/api/na-core-utils.h
+++ b/src/api/na-core-utils.h
@@ -56,7 +56,7 @@ gchar *na_core_utils_str_remove_suffix( const gchar *string, const gchar *suff
GSList *na_core_utils_slist_duplicate( GSList *list );
void na_core_utils_slist_dump( GSList *list );
GSList *na_core_utils_slist_from_split( const gchar *string, const gchar *separator );
-GSList *na_core_utils_slist_from_str_array( const gchar **str_array );
+GSList *na_core_utils_slist_from_array( const gchar **str_array );
GSList *na_core_utils_slist_remove_ascii( GSList *list, const gchar *text );
GSList *na_core_utils_slist_remove_utf8( GSList *list, const gchar *string );
gchar *na_core_utils_slist_to_text( GSList *list );
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 68f7e19..a651d65 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -179,9 +179,9 @@ na_core_utils_slist_dump( GSList *list )
int c;
g_debug( "%s: list at %p has %d elements", thisfn, ( void * ) list, g_slist_length( list ));
- for( i=list, c=0 ; i ; i=i->next, c++ ){
- gchar *s = ( gchar * ) i->data;
- g_debug( "%s: %2d - %s", thisfn, c, s );
+
+ for( i=list, c=0 ; i ; i=i->next ){
+ g_debug( "%s: [%2d] %s", thisfn, c++, ( gchar * ) i->data );
}
}
@@ -212,7 +212,7 @@ na_core_utils_slist_from_split( const gchar *text, const gchar *separator )
}
tokens = g_strsplit( tmp, separator, -1 );
- slist = na_core_utils_slist_from_str_array(( const gchar ** ) tokens );
+ slist = na_core_utils_slist_from_array(( const gchar ** ) tokens );
g_strfreev( tokens );
g_free( source );
@@ -221,14 +221,14 @@ na_core_utils_slist_from_split( const gchar *text, const gchar *separator )
}
/**
- * na_core_utils_slist_from_str_array:
+ * na_core_utils_slist_from_array:
* @str_array: an NULL-terminated array of strings.
*
* Returns: a #GSList list of strings, which should be #na_core_utils_slist_free()
* by the caller.
*/
GSList *
-na_core_utils_slist_from_str_array( const gchar **str_array )
+na_core_utils_slist_from_array( const gchar **str_array )
{
GSList *slist;
gchar **idx;
@@ -450,7 +450,7 @@ text_to_string_list( const gchar *text, const gchar *separator, const gchar *def
} else {
tokens = g_strsplit( source, separator, -1 );
- strlist = na_core_utils_slist_from_str_array(( const gchar ** ) tokens );
+ strlist = na_core_utils_slist_from_array(( const gchar ** ) tokens );
g_strfreev( tokens );
}
diff --git a/src/io-desktop/nadp-desktop-file.c b/src/io-desktop/nadp-desktop-file.c
index 579f562..3cac402 100644
--- a/src/io-desktop/nadp-desktop-file.c
+++ b/src/io-desktop/nadp-desktop-file.c
@@ -411,6 +411,10 @@ nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, c
/**
* nadp_desktop_file_get_locale_string:
+ *
+ * Note that g_key_file_has_key doesn't deal correctly with localized
+ * strings which have a key[modifier] (it recognizes them as the key
+ * "key[modifier]", not "key")
*/
gchar *
nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, const gchar *default_value )
@@ -418,7 +422,6 @@ nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *gr
static const gchar *thisfn = "nadp_desktop_file_get_locale_string";
gchar *value;
gchar *read_value;
- gboolean has_entry;
GError *error;
value = g_strdup( default_value );
@@ -428,22 +431,17 @@ nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *gr
if( !ndf->private->dispose_has_run ){
error = NULL;
- has_entry = g_key_file_has_key( ndf->private->key_file, group, entry, &error );
- if( error ){
- g_warning( "%s: %s", thisfn, error->message );
- g_error_free( error );
- } else if( has_entry ){
- read_value = g_key_file_get_locale_string( ndf->private->key_file, group, entry, NULL, &error );
- if( error ){
+ read_value = g_key_file_get_locale_string( ndf->private->key_file, group, entry, NULL, &error );
+ if( !read_value || error ){
+ if( error->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND ){
g_warning( "%s: %s", thisfn, error->message );
g_error_free( error );
g_free( read_value );
-
- } else {
- g_free( value );
- value = read_value;
}
+ } else {
+ g_free( value );
+ value = read_value;
}
}
@@ -523,7 +521,7 @@ nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *grou
} else {
na_core_utils_slist_free( value );
- value = na_core_utils_slist_from_str_array(( const gchar ** ) read_array );
+ value = na_core_utils_slist_from_array(( const gchar ** ) read_array );
}
g_strfreev( read_array );
diff --git a/src/io-desktop/nadp-desktop-provider.c b/src/io-desktop/nadp-desktop-provider.c
index 40cb1f9..a20afdd 100644
--- a/src/io-desktop/nadp-desktop-provider.c
+++ b/src/io-desktop/nadp-desktop-provider.c
@@ -310,21 +310,24 @@ iio_factory_read_value( const NAIIOFactory *reader, void *reader_data, const Nad
case NADF_TYPE_LOCALE_STRING:
g_value_init( value, G_TYPE_STRING );
str_value = nadp_desktop_file_get_locale_string( nrd->ndf, group, key, iddef->default_value );
- g_value_set_string( value, str_value );
- /*g_free( str_value );*/
+ /*g_value_set_string( value, str_value );*/
+ g_debug( "%s: %s=%s", thisfn, iddef->name, str_value );
+ g_free( str_value );
break;
case NADF_TYPE_STRING:
g_value_init( value, G_TYPE_STRING );
str_value = nadp_desktop_file_get_string( nrd->ndf, group, key, iddef->default_value );
g_value_set_string( value, str_value );
- /*g_free( str_value );*/
+ /*g_debug( "%s: %s=%s", thisfn, iddef->name, str_value );*/
+ g_free( str_value );
break;
case NADF_TYPE_BOOLEAN:
g_value_init( value, G_TYPE_BOOLEAN );
bool_value = nadp_desktop_file_get_boolean( nrd->ndf, group, key, na_core_utils_boolean_from_string( iddef->default_value ));
g_value_set_boolean( value, bool_value );
+ /*g_debug( "%s: %s=%s", thisfn, iddef->name, bool_value ? "True":"False" );*/
break;
case NADF_TYPE_STRING_LIST:
@@ -339,6 +342,7 @@ iio_factory_read_value( const NAIIOFactory *reader, void *reader_data, const Nad
*messages = g_slist_append( *messages, msg );
}
+ /*g_debug( "%s: group=%s, key=%s", thisfn, group, key );*/
g_free( key );
g_free( group );
}
diff --git a/src/io-desktop/nadp-xdg-dirs.c b/src/io-desktop/nadp-xdg-dirs.c
index a1e0275..339827e 100644
--- a/src/io-desktop/nadp-xdg-dirs.c
+++ b/src/io-desktop/nadp-xdg-dirs.c
@@ -107,7 +107,7 @@ nadp_xdg_dirs_get_system_data_dirs( void )
dirs = ( const gchar ** ) g_get_system_data_dirs();
- paths = na_core_utils_slist_from_str_array( dirs );
+ paths = na_core_utils_slist_from_array( dirs );
return( paths );
}
diff --git a/src/nact/base-iprefs.c b/src/nact/base-iprefs.c
index 235241b..5a1a13d 100644
--- a/src/nact/base-iprefs.c
+++ b/src/nact/base-iprefs.c
@@ -94,7 +94,7 @@ register_type( void )
g_debug( "%s", thisfn );
- type = g_type_register_static( NA_IPREFS_TYPE, "BaseIPrefs", &info, 0 );
+ type = g_type_register_static( G_TYPE_INTERFACE, "BaseIPrefs", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
diff --git a/src/nact/base-iprefs.h b/src/nact/base-iprefs.h
index 4b0b4a4..f38b99d 100644
--- a/src/nact/base-iprefs.h
+++ b/src/nact/base-iprefs.h
@@ -42,8 +42,6 @@
* to this function.
*/
-#include <core/na-iprefs.h>
-
#include "base-window.h"
G_BEGIN_DECLS
@@ -58,7 +56,7 @@ typedef struct BaseIPrefs BaseIPrefs;
typedef struct BaseIPrefsInterfacePrivate BaseIPrefsInterfacePrivate;
typedef struct {
- NAIPrefsInterface parent;
+ GTypeInterface parent;
BaseIPrefsInterfacePrivate *private;
/* api */
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 103d5c9..3e30723 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -39,6 +39,7 @@
#include <api/na-core-utils.h>
#include <core/na-importer.h>
+#include <core/na-iprefs.h>
#include "nact-application.h"
#include "nact-iprefs.h"
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 81963b3..d942fec 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -38,6 +38,8 @@
#include <api/na-core-utils.h>
#include <api/na-object-api.h>
+#include <core/na-iprefs.h>
+
#include "base-window.h"
#include "base-iprefs.h"
#include "nact-application.h"
diff --git a/src/nact/nact-import-ask.c b/src/nact/nact-import-ask.c
index a774b6a..d4ba257 100644
--- a/src/nact/nact-import-ask.c
+++ b/src/nact/nact-import-ask.c
@@ -36,6 +36,8 @@
#include <api/na-object-api.h>
+#include <core/na-iprefs.h>
+
#include "nact-application.h"
#include "nact-iprefs.h"
#include "nact-import-ask.h"
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 611b211..95dcb35 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -35,6 +35,8 @@
#include <api/na-gconf-utils.h>
+#include <core/na-iprefs.h>
+
#include "nact-application.h"
#include "nact-iprefs.h"
@@ -97,7 +99,7 @@ register_type( void )
g_debug( "%s", thisfn );
- type = g_type_register_static( NA_IPREFS_TYPE, "NactIPrefs", &info, 0 );
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIPrefs", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 30e524e..fc206c9 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -39,8 +39,6 @@
* This interface cooperates with #NactWindow to manage preferences.
*/
-#include <core/na-iprefs.h>
-
#include "base-window.h"
G_BEGIN_DECLS
@@ -55,7 +53,7 @@ typedef struct NactIPrefs NactIPrefs;
typedef struct NactIPrefsInterfacePrivate NactIPrefsInterfacePrivate;
typedef struct {
- NAIPrefsInterface parent;
+ GTypeInterface parent;
NactIPrefsInterfacePrivate *private;
}
NactIPrefsInterface;
diff --git a/src/nact/nact-main-toolbar.c b/src/nact/nact-main-toolbar.c
index 56d8400..552d90e 100644
--- a/src/nact/nact-main-toolbar.c
+++ b/src/nact/nact-main-toolbar.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <core/na-iprefs.h>
+
#include "nact-application.h"
#include "nact-iprefs.h"
#include "nact-main-toolbar.h"
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 7df5939..2208f58 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <core/na-iprefs.h>
+
#include "nact-application.h"
#include "nact-iprefs.h"
#include "nact-export-format.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]