Commit 87282ae3 authored by Pierre Wieser's avatar Pierre Wieser

Fix edition status and saving in the UI

parent f13bdbee
2009-09-22 Pierre Wieser <pwieser@trychlos.org>
* configure.ac: Add a comment about GtkActivatable.
* src/common/na-iduplicable.c:
* src/common/na-iduplicable.h:
Reorganize the code and add comments about recursivity inside.
* src/common/na-iio-provider.c:
Replace local dump_hierarchy() with call to na_object_dump_tree().
na_iio_provider_write_item(): Make debug trace more verbose.
* src/common/na-object-action.c:
* src/common/na-object-action.h:
Output debug traces depending on NAIDuplicable flag.
Fix equality check if a profile is modified.
* src/common/na-object-api.h (na_object_dump_norec,
na_object_dump_tree, na_object_rewind_origin): New functions.
na_object_insert_item(): Add a sibling pointer.
* src/common/na-object.c:
* src/common/na-object-fn.h:
Reorganize the code and add comments about recursivity inside.
* src/common/na-object-id.c:
* src/common/na-object-menu.c:
* src/common/na-object-profile.c: Make debug trace more verbose.
* src/common/na-object-item.c:
* src/common/na-object-item-fn.h (na_object_item_insert_item):
Add a sibling pointer.
na_object_item_free_items(): Only unref if object is always valid.
object_are_equal(): Position is a factor of equality.
* src/common/na-pivot.c:
* src/common/na-pivot.h (na_pivot_get_item): New function.
* src/nact/nact-assistant-import.c:
Actually imports the actions into the tree store before
confirming the operation was done.
* nact/nact-iactions-list.c:
* nact/nact-iactions-list.h (nact_iactions_list_get_item):
New function.
* src/nact/nact-main-menubar.c:
Do not use GtkActivatable if version <= 2.16.
Rewrite save items process.
* src/nact/nact-main-window.c (nact_main_window_action_exists):
Restore the function, searching in NAPivot and in tree store.
* src/nact/nact-tree-model.c:
Now inserts the new row before a given sibling object.
2009-09-21 Pierre Wieser <pwieser@trychlos.org>
* src/common/na-gconf-provider.c (write_item_menu):
......
......@@ -50,3 +50,5 @@
cf. commit 5ee6938486cd82f1274969506873df950348dd61 and before
function nact-tree-model.c::add_parent
recreate a small code which reproduces this bug and open in bugzilla
- lot of work to do on gconf editor
......@@ -111,6 +111,7 @@ AM_GCONF_SOURCE_2
# Gtk >= 2.12: GtkBuilder
#
# [nact-assistant] remove work-around for #589745 when Gtk+ >= 2.18
# [nact-main-menubar] GtkActivatable only available starting with Gtk+ 2.16
#
# [configure.ac, nautilus-actions.c] remove test for
# nautilus_menu_provider_emit_items_updated_signal() when Gnome >= 2.16
......
......@@ -253,43 +253,6 @@ na_iduplicable_dump( const NAIDuplicable *object )
g_debug( "%s: valid=%s", thisfn, valid ? "True" : "False" );
}
/**
* na_iduplicable_duplicate:
* @object: the #NAIDuplicable object to be duplicated.
*
* Exactly duplicates a #NAIDuplicable-implemented object.
* Properties %NA_IDUPLICABLE_PROP_ORIGIN, %PROP_IDUPLICABLE_ISMODIFIED
* and %PROP_IDUPLICABLE_ISVALID are initialized to their default
* values.
*
* As %PROP_IDUPLICABLE_ISVALID property is set to %TRUE without any
* further check, this suppose that only valid objects are duplicated.
*
* Returns: a new #NAIDuplicable.
*/
NAIDuplicable *
na_iduplicable_duplicate( const NAIDuplicable *object )
{
/*static const gchar *thisfn = "na_iduplicable_duplicate";*/
NAIDuplicable *dup = NULL;
/*g_debug( "%s: object=%p", thisfn, ( void * ) object );*/
g_return_val_if_fail( st_initialized && !st_finalized, NULL );
g_return_val_if_fail( NA_IS_IDUPLICABLE( object ), NULL );
dup = v_new( object );
if( dup ){
v_copy( dup, object );
set_origin( dup, object );
set_modified( dup, FALSE );
set_valid( dup, TRUE );
}
return( dup );
}
/**
* na_iduplicable_check_edition_status:
* @object: the #NAIDuplicable object to be checked.
......@@ -307,7 +270,7 @@ na_iduplicable_duplicate( const NAIDuplicable *object )
* That is, the modification and validity status are only set on the
* specified object.
* Nonetheless, a derived class may perfectly implement a recursive
* check on childs, if any. See, e.g. #NAObjectItem implementation.
* check on childs, if any. See, e.g. #NAObject implementation.
*/
void
na_iduplicable_check_edition_status( const NAIDuplicable *object )
......@@ -346,6 +309,43 @@ na_iduplicable_check_edition_status( const NAIDuplicable *object )
#endif
}
/**
* na_iduplicable_duplicate:
* @object: the #NAIDuplicable object to be duplicated.
*
* Exactly duplicates a #NAIDuplicable-implemented object.
* Properties %NA_IDUPLICABLE_PROP_ORIGIN, %PROP_IDUPLICABLE_ISMODIFIED
* and %PROP_IDUPLICABLE_ISVALID are initialized to their default
* values.
*
* As %PROP_IDUPLICABLE_ISVALID property is set to %TRUE without any
* further check, this suppose that only valid objects are duplicated.
*
* Returns: a new #NAIDuplicable.
*/
NAIDuplicable *
na_iduplicable_duplicate( const NAIDuplicable *object )
{
/*static const gchar *thisfn = "na_iduplicable_duplicate";*/
NAIDuplicable *dup = NULL;
/*g_debug( "%s: object=%p", thisfn, ( void * ) object );*/
g_return_val_if_fail( st_initialized && !st_finalized, NULL );
g_return_val_if_fail( NA_IS_IDUPLICABLE( object ), NULL );
dup = v_new( object );
if( dup ){
v_copy( dup, object );
set_origin( dup, object );
set_modified( dup, FALSE );
set_valid( dup, TRUE );
}
return( dup );
}
/**
* na_iduplicable_is_modified:
* @object: the #NAIDuplicable object whose status is to be returned.
......
......@@ -145,21 +145,18 @@ typedef struct {
#define NA_IDUPLICABLE_SIGNAL_MODIFIED_CHANGED "na-iduplicable-modified-changed"
#define NA_IDUPLICABLE_SIGNAL_VALID_CHANGED "na-iduplicable-valid-changed"
#define NA_IDUPLICABLE_EDITION_STATUS_DEBUG 0
#define NA_IDUPLICABLE_EDITION_STATUS_DEBUG 1
GType na_iduplicable_get_type( void );
void na_iduplicable_init( NAIDuplicable *object );
void na_iduplicable_dump( const NAIDuplicable *object );
NAIDuplicable *na_iduplicable_duplicate( const NAIDuplicable *object );
void na_iduplicable_check_edition_status( const NAIDuplicable *object );
NAIDuplicable *na_iduplicable_duplicate( const NAIDuplicable *object );
gboolean na_iduplicable_is_modified( const NAIDuplicable *object );
gboolean na_iduplicable_is_valid( const NAIDuplicable *object );
NAIDuplicable *na_iduplicable_get_origin( const NAIDuplicable *object );
void na_iduplicable_set_origin( NAIDuplicable *object, const NAIDuplicable *origin );
void na_iduplicable_register_consumer( GObject *consumer );
......
......@@ -55,7 +55,6 @@ static void interface_base_finalize( NAIIOProviderInterface *klass );
static GList *build_hierarchy( GList *tree, GSList *level_zero, gboolean list_if_empty );
static gint search_item( const NAObject *obj, const gchar *uuid );
static GList *get_merged_items_list( const NAPivot *pivot, GSList *providers );
static void dump_hierarchy( GList *tree, gint level );
static guint try_write_item( const NAIIOProvider *instance, NAObject *item, gchar **message );
......@@ -180,7 +179,7 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
hierarchy = sort_tree( pivot, hierarchy );
}
dump_hierarchy( hierarchy, 0 );
na_object_dump_tree( hierarchy );
return( hierarchy );
}
......@@ -280,35 +279,6 @@ get_merged_items_list( const NAPivot *pivot, GSList *providers )
return( merged );
}
static void
dump_hierarchy( GList *tree, gint level )
{
GString *prefix;
gint i;
GList *subitems, *it;
gchar *id;
prefix = g_string_new( "" );
for( i = 0 ; i < level ; ++i ){
g_string_append_printf( prefix, " " );
}
for( it = tree ; it ; it = it->next ){
id = na_object_get_id( it->data );
g_debug( "nact_iio_provider_dump_hierarchy: %s%p (%s) %s",
prefix->str, ( void * ) it->data, G_OBJECT_TYPE_NAME( it->data ), id );
g_free( id );
if( NA_IS_OBJECT_ITEM( it->data )){
subitems = na_object_get_items( it->data );
dump_hierarchy( subitems, level+1 );
na_object_free_items( subitems );
}
}
g_string_free( prefix, TRUE );
}
/**
* na_iio_provider_write_item:
* @pivot: the #NAPivot object which owns the list of registered I/O
......@@ -331,8 +301,10 @@ na_iio_provider_write_item( const NAPivot *pivot, NAObject *item, gchar **messag
NAIIOProvider *bad_instance;
GSList *providers, *ip;
g_debug( "%s: pivot=%p, item=%p, message=%p",
thisfn, ( void * ) pivot, ( void * ) item, ( void * ) message );
g_debug( "%s: pivot=%p (%s), item=%p (%s), message=%p", thisfn,
( void * ) pivot, G_OBJECT_TYPE_NAME( pivot ),
( void * ) item, G_OBJECT_TYPE_NAME( item ),
( void * ) message );
g_return_val_if_fail( st_initialized && !st_finalized, NA_IIO_PROVIDER_PROGRAM_ERROR );
g_return_val_if_fail(( NA_IS_PIVOT( pivot ) || !pivot ), NA_IIO_PROVIDER_PROGRAM_ERROR );
......@@ -424,8 +396,10 @@ na_iio_provider_delete_item( const NAPivot *pivot, const NAObject *item, gchar *
guint ret;
NAIIOProvider *instance;
g_debug( "%s: pivot=%p, item=%p, message=%p",
thisfn, ( void * ) pivot, ( void * ) item, ( void * ) message );
g_debug( "%s: pivot=%p (%s), item=%p (%s), message=%p", thisfn,
( void * ) pivot, G_OBJECT_TYPE_NAME( pivot ),
( void * ) item, G_OBJECT_TYPE_NAME( item ),
( void * ) message );
g_return_val_if_fail( st_initialized && !st_finalized, NA_IIO_PROVIDER_PROGRAM_ERROR );
g_return_val_if_fail( NA_IS_PIVOT( pivot ), NA_IIO_PROVIDER_PROGRAM_ERROR );
......
......@@ -34,6 +34,7 @@
#include <string.h>
#include "na-iduplicable.h"
#include "na-object-api.h"
#include "na-object-action.h"
#include "na-object-profile.h"
......@@ -551,7 +552,7 @@ object_copy( NAObject *target, const NAObject *source )
* note 1: version is not localized (see configure.ac)
*
* note 2: when checking for equality of profiles, we know that NAObjectItem
* has already checked their edition status, and assert that profiles lists
* has already checked their edition status, and that the two profiles lists
* were the sames ; we so only report the modification status to the action
*/
static gboolean
......@@ -577,7 +578,7 @@ object_are_equal( const NAObject *a, const NAObject *b )
if( equal ){
profiles = na_object_get_items( a );
for( ip = profiles ; ip ; ip = ip->next ){
for( ip = profiles ; ip && equal ; ip = ip->next ){
id = na_object_get_id( ip->data );
profile = NA_OBJECT_PROFILE( na_object_get_item( b, id ));
equal = !na_object_is_modified( profile );
......@@ -593,7 +594,13 @@ object_are_equal( const NAObject *a, const NAObject *b )
na_object_free_items( profiles );
}
/*g_debug( "na_object_action_are_equal: %s", equal ? "True":"False" );*/
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_action_object_are_equal: a=%p (%s), b=%p (%s), are_equal=%s",
( void * ) a, G_OBJECT_TYPE_NAME( a ),
( void * ) b, G_OBJECT_TYPE_NAME( b ),
equal ? "True":"False" );
#endif
return( equal );
}
......
......@@ -39,7 +39,7 @@
* This is the class which maintains data and properties of an Nautilus
* action.
*
* Note about the UUID:
* Note about the UUID :
*
* The uuid is only required when writing the action to GConf in order
* to ensure unicity of subdirectories.
......@@ -49,6 +49,12 @@
* Note that a user may import an action, translate it and then
* reexport it : we so may have two different actions with the same
* uuid. The user has so to modify the UUID before import.
*
* Note about edition status :
*
* As a particular rule of #NAObjectItem derived class, an action is
* considered modified as soon as any of its profiles has been modified
* itself (because they are saved as a whole).
*/
#include <glib/gi18n.h>
......
......@@ -46,9 +46,11 @@ G_BEGIN_DECLS
/* NAObject
*/
#define na_object_dump( object ) na_object_object_dump( NA_OBJECT( object ))
#define na_object_dump_norec( object ) na_object_object_dump_norec( NA_OBJECT( object ))
#define na_object_dump_tree( tree ) na_object_object_dump_tree( tree )
#define na_object_get_clipboard_id( object ) na_object_object_get_clipboard_id( NA_OBJECT( object ))
#define na_object_ref( object ) na_object_object_ref( NA_OBJECT( object ))
#define na_object_copy( target, source ) na_object_object_copy( NA_OBJECT( target ), NA_OBJECT( source ))
#define na_object_rewind_origin( target, source ) na_object_object_rewind_origin( NA_OBJECT( target ), NA_OBJECT( source ))
/* NAIDuplicable
*/
......@@ -59,7 +61,6 @@ G_BEGIN_DECLS
#define na_object_get_origin( object ) na_object_iduplicable_get_origin( NA_OBJECT( object ))
#define na_object_set_origin( object, origin ) na_object_iduplicable_set_origin( NA_OBJECT( object ), NA_OBJECT( origin ))
#define na_object_set_origin_rec( object, origin ) na_object_iduplicable_set_origin_recurse( NA_OBJECT( object ), NA_OBJECT( origin ))
/* NAObjectId
*/
......@@ -89,7 +90,7 @@ G_BEGIN_DECLS
#define na_object_set_items( object, list ) na_object_item_set_items( NA_OBJECT_ITEM( object ), list )
#define na_object_append_item( object, item ) na_object_item_append_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ))
#define na_object_insert_item( object, item ) na_object_item_insert_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ))
#define na_object_insert_item( object, item, before ) na_object_item_insert_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ), NA_OBJECT( before ))
#define na_object_remove_item( object, item ) na_object_item_remove_item( NA_OBJECT_ITEM( object ), NA_OBJECT( item ))
G_END_DECLS
......
......@@ -46,28 +46,28 @@
G_BEGIN_DECLS
/* NAObject
*/
void na_object_object_dump( const NAObject *object );
gchar *na_object_object_get_clipboard_id( const NAObject *object );
NAObject *na_object_object_ref( const NAObject *object );
void na_object_object_copy( NAObject *target, const NAObject *source );
GList *na_object_get_hierarchy( const NAObject *object );
void na_object_free_hierarchy( GList *hierarchy );
/* NAIDuplicable
*/
void na_object_iduplicable_check_edition_status( const NAObject *object );
NAObject *na_object_iduplicable_duplicate( const NAObject *object );
void na_object_iduplicable_check_edition_status( const NAObject *object );
gboolean na_object_iduplicable_are_equal( const NAObject *a, const NAObject *b );
gboolean na_object_iduplicable_is_modified( const NAObject *object );
gboolean na_object_iduplicable_is_valid( const NAObject *object );
NAObject *na_object_iduplicable_get_origin( const NAObject *object );
void na_object_iduplicable_set_origin( NAObject *object, const NAObject *origin );
void na_object_iduplicable_set_origin_recurse( NAObject *object, const NAObject *origin );
/* NAObject
*/
void na_object_object_dump( const NAObject *object );
void na_object_object_dump_norec( const NAObject *object );
void na_object_object_dump_tree( GList *tree );
gchar *na_object_object_get_clipboard_id( const NAObject *object );
NAObject *na_object_object_ref( const NAObject *object );
void na_object_object_rewind_origin( NAObject *target, const NAObject *source );
GList *na_object_get_hierarchy( const NAObject *object );
void na_object_free_hierarchy( GList *hierarchy );
G_END_DECLS
......
......@@ -34,6 +34,7 @@
#include <string.h>
#include "na-iduplicable.h"
#include "na-object-fn.h"
#include "na-object-id-class.h"
#include "na-object-id-fn.h"
......@@ -432,7 +433,13 @@ object_are_equal( const NAObject *a, const NAObject *b )
}
}
/*g_debug( "na_object_id_are_equal: %s", equal ? "True":"False" );*/
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_id_object_are_equal: a=%p (%s), b=%p (%s), are_equal=%s",
( void * ) a, G_OBJECT_TYPE_NAME( a ),
( void * ) b, G_OBJECT_TYPE_NAME( b ),
equal ? "True":"False" );
#endif
return( equal );
}
......
......@@ -78,8 +78,8 @@ void na_object_item_set_provider( NAObjectItem *item, const NAIIOProvi
void na_object_item_set_items( NAObjectItem *item, GList *items );
void na_object_item_append_item( NAObjectItem *item, const NAObject *object );
void na_object_item_insert_item( NAObjectItem *item, const NAObject *object );
void na_object_item_remove_item( NAObjectItem *item, NAObject *object );
void na_object_item_insert_item( NAObjectItem *item, const NAObject *object, const NAObject *before );
void na_object_item_remove_item( NAObjectItem *item, const NAObject *object );
G_END_DECLS
......
......@@ -35,6 +35,7 @@
#include <string.h>
#include <uuid/uuid.h>
#include "na-iduplicable.h"
#include "na-object-api.h"
#include "na-object-item-class.h"
#include "na-object-item-fn.h"
......@@ -562,7 +563,14 @@ na_object_item_get_items_count( const NAObjectItem *item )
void
na_object_item_free_items( GList *items )
{
g_list_foreach( items, ( GFunc ) g_object_unref, NULL );
GList *it;
for( it = items ; it ; it = it->next ){
if( G_IS_OBJECT( it->data )){
g_object_unref( it->data );
}
}
g_list_free( items );
}
......@@ -714,50 +722,60 @@ na_object_item_append_item( NAObjectItem *item, const NAObject *object )
/**
* na_object_item_insert_item:
* @item: the #NAObjectItem to which add the subitem.
* @object: a #NAObject to be inserted at the list of subitems.
* @object: a #NAObject to be inserted in the list of subitems.
* @before: the #NAObject before which the @object should be inserted.
*
* Inserts a new @object at the beginning of the list of subitems of
* @item.
* Inserts a new @object in the list of subitems of @item.
*
* We add a reference on provided @object.
*/
void
na_object_item_insert_item( NAObjectItem *item, const NAObject *object )
na_object_item_insert_item( NAObjectItem *item, const NAObject *object, const NAObject *before )
{
GList *before_list;
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
g_return_if_fail( !item->private->dispose_has_run );
g_return_if_fail( NA_IS_OBJECT( object ));
g_return_if_fail( NA_IS_OBJECT( before ));
if( !g_list_find( item->private->items, ( gpointer ) object )){
item->private->items = g_list_prepend( item->private->items, g_object_ref(( gpointer ) object ));
before_list = g_list_find( item->private->items, ( gconstpointer ) before );
if( before_list ){
item->private->items = g_list_insert_before( item->private->items, before_list, g_object_ref(( gpointer ) object ));
} else {
item->private->items = g_list_prepend( item->private->items, g_object_ref(( gpointer ) object ));
}
}
}
/**
* na_object_item_remove_item:
* @item: the #NAObjectItem item from which the subitems must be removed.
* @object: a #NAObject object to be removed from list of subitems.
* @item: the #NAObjectItem from which the subitem must be removed.
* @object: a #NAObject to be removed from the list of subitems.
*
* Removes a subitem from the list of subitems.
* Removes an @object from the list of subitems of @item.
*
* We also decrement the reference count on removed subitem.
* We decrement the reference count on @object.
*/
void
na_object_item_remove_item( NAObjectItem *item, NAObject *object )
na_object_item_remove_item( NAObjectItem *item, const NAObject *object )
{
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
g_return_if_fail( !item->private->dispose_has_run );
g_return_if_fail( NA_IS_OBJECT( object ));
item->private->items = g_list_remove( item->private->items, ( gconstpointer ) object );
g_object_unref( object );
if( g_list_find( item->private->items, ( gconstpointer ) object )){
item->private->items = g_list_remove( item->private->items, ( gconstpointer ) object );
g_object_unref(( gpointer ) object );
}
}
static void
object_dump( const NAObject *item )
{
static const gchar *thisfn = "na_object_item_object_dump";
GList *it;
/*GList *it;*/
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
g_return_if_fail( !NA_OBJECT_ITEM( item )->private->dispose_has_run );
......@@ -773,9 +791,13 @@ object_dump( const NAObject *item )
NA_OBJECT_ITEM( item )->private->items ? g_list_length( NA_OBJECT_ITEM( item )->private->items ) : 0,
( void * ) NA_OBJECT_ITEM( item )->private->items );
for( it = NA_OBJECT_ITEM( item )->private->items ; it ; it = it->next ){
/* do not recurse here, as this is actually dealt with by
* na_object_dump() api ;
* else, we would have the action being dumped after its childs
*/
/*for( it = NA_OBJECT_ITEM( item )->private->items ; it ; it = it->next ){
na_object_dump( it->data );
}
}*/
}
static void
......@@ -832,21 +854,30 @@ object_copy( NAObject *target, const NAObject *source )
*
* note 1: The provider is not considered as pertinent here
*
* note 2: NAObjectItem recursively checks for equality in subitems.
* Nonetheless, the modification status of subitems doesn't have any
* note 2: as a particular case, this function is not recursive
* because the equality test will stop as soon as it fails, and we so
* cannot be sure to even come here.
*
* The recursivity of na_object_check_edition_status() is directly
* dealt with by the main entry api function.
*
* More, the modification status of subitems doesn't have any
* impact on this object itself, provided that subitems lists are
* themselves identical
*
* note 3: Only NAObjectAction is modified that one of the profiles are
* modified (because they are saved as a whole)
* note 3: #NAObjectAction is considered as modified when at least one
* of the profiles is itself modified (because they are saved as a
* whole). See #NAObjectAction.
*/
static gboolean
object_are_equal( const NAObject *a, const NAObject *b )
{
gboolean equal = TRUE;
GList *it;
NAObject *first_obj, *second_obj;
gchar *first_id, *second_id;
NAObject *first_obj, *second_obj;
gint first_pos, second_pos;
GList *second_list;
g_return_val_if_fail( NA_IS_OBJECT_ITEM( a ), FALSE );
g_return_val_if_fail( !NA_OBJECT_ITEM( a )->private->dispose_has_run, FALSE );
......@@ -870,37 +901,49 @@ object_are_equal( const NAObject *a, const NAObject *b )
if( equal ){
for( it = NA_OBJECT_ITEM( a )->private->items ; it && equal ; it = it->next ){
first_obj = NA_OBJECT( it->data );
first_id = na_object_get_id( first_obj );
second_obj = ( NAObject * ) na_object_get_item( b, first_id );
g_free( first_id );
first_id = na_object_get_id( it->data );
second_obj = na_object_get_item( b, first_id );
if( second_obj ){
na_object_check_edition_status( second_obj );
first_pos = g_list_position( NA_OBJECT_ITEM( a )->private->items, it );
second_list = g_list_find( NA_OBJECT_ITEM( b )->private->items, second_obj );
second_pos = g_list_position( NA_OBJECT_ITEM( b )->private->items, second_list );
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_item_object_are_equal: first_pos=%u, second_pos=%u", first_pos, second_pos );
#endif
if( first_pos != second_pos ){
equal = FALSE;
}
} else {
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_item_are_equal: object=%p (%s), equal=False", ( void * ) b, G_OBJECT_TYPE_NAME( b ));
g_debug( "na_object_item_object_are_equal: id=%s not found in b", first_id );
#endif
equal = FALSE;
}
g_free( first_id );
}
}
if( equal ){
for( it = NA_OBJECT_ITEM( b )->private->items ; it && equal ; it = it->next ){
second_obj = NA_OBJECT( it->data );
second_id = na_object_get_id( second_obj );
first_obj = ( NAObject * ) na_object_get_item( a, second_id );
g_free( second_id );
second_id = na_object_get_id( it->data );
first_obj = na_object_get_item( a, second_id );
if( !first_obj ){
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_item_are_equal: object=%p (%s), equal=False", ( void * ) b, G_OBJECT_TYPE_NAME( b ));
g_debug( "na_object_item_object_are_equal: id=%s not found in a", second_id );
#endif
equal = FALSE;
}
g_free( second_id );
}
}
/*g_debug( "na_object_item_are_equal: %s", equal ? "True":"False" );*/
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_item_object_are_equal: a=%p (%s), b=%p (%s), are_equal=%s",
( void * ) a, G_OBJECT_TYPE_NAME( a ),
( void * ) b, G_OBJECT_TYPE_NAME( b ),
equal ? "True":"False" );
#endif
return( equal );
}
......@@ -911,16 +954,16 @@ static gboolean
object_is_valid( const NAObject *object )
{
gboolean valid = TRUE;
GList *it;
/*GList *it;*/
g_return_val_if_fail( NA_IS_OBJECT_ITEM( object ), FALSE );
g_return_val_if_fail( !NA_OBJECT_ITEM( object )->private->dispose_has_run, FALSE );
if( valid ){
/*if( valid ){
for( it = NA_OBJECT_ITEM( object )->private->items ; it && valid ; it = it->next ){
valid = na_object_is_valid( it->data );
}
}
}*/
return( valid );
}
......
......@@ -32,6 +32,7 @@
#include <config.h>
#endif
#include "na-iduplicable.h"
#include "na-object-api.h"
#include "na-object-action.h"
#include "na-object-menu.h"
......
......@@ -36,6 +36,7 @@
#include <libnautilus-extension/nautilus-file-info.h>
#include "na-iduplicable.h"
#include "na-object-api.h"
#include "na-object-action.h"
#include "na-object-profile.h"
......@@ -1551,6 +1552,13 @@ object_are_equal( const NAObject *a, const NAObject *b )
na_utils_string_lists_are_equal( first->private->schemes, second->private->schemes );
}
#if NA_IDUPLICABLE_EDITION_STATUS_DEBUG
g_debug( "na_object_profile_object_are_equal: a=%p (%s), b=%p (%s), are_equal=%s",
( void * ) a, G_OBJECT_TYPE_NAME( a ),
( void * ) b, G_OBJECT_TYPE_NAME( b ),
equal ? "True":"False" );
#endif
return( equal );
}
......
This diff is collapsed.
......@@ -93,28 +93,30 @@ static guint st_event_source_id = 0;
static gint st_timeout_msec = 100;
static gint st_timeout_usec = 100000;
static GType register_type( void );
static void class_init( NAPivotClass *klass );
static void iprefs_iface_init( NAIPrefsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static GType register_type( void );
static void class_init( NAPivotClass *klass );
static void iprefs_iface_init( NAIPrefsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static NAObject *get_item_from_tree( const NAPivot *pivot, GList *tree, uuid_t uuid );
/* NAIPivotConsumer management */
static void free_consumers( GSList *list );
static void free_consumers( GSList *list );
/* NAIIOProvider management */
static void register_io_providers( NAPivot *pivot );
static void register_io_providers( NAPivot *pivot );
/* NAGConf runtime preferences management */
static void read_runtime_preferences( NAPivot *pivot );
static void read_runtime_preferences( NAPivot *pivot );