Commit 83e758a8 authored by Pierre Wieser's avatar Pierre Wieser

More refactoring

parent 845f734d
......@@ -88,10 +88,8 @@ typedef struct {
*
* Dumps via g_debug the content of the object.
*
* NAObject class takes care of calling this function for each
* derived class, starting from topmost base class up to most-
* derived one. Each derived class has so only to take care of
* dumping its own data.
* The derived class should call its parent class at the end of the
* dump of its own datas.
*
* Since: 2.30
*/
......
......@@ -333,7 +333,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_dispose( GObject *object )
{
static const gchar *thisfn = "na_data_boxed_instance_dispose";
NADataBoxed *self;
g_return_if_fail( NA_IS_DATA_BOXED( object ));
......@@ -342,11 +341,6 @@ instance_dispose( GObject *object )
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s), name=%s",
thisfn,
( void * ) object, G_OBJECT_TYPE_NAME( object ),
NA_DATA_BOXED( object )->private->def->name );
self->private->dispose_has_run = TRUE;
/* chain up to the parent class */
......
......@@ -574,11 +574,10 @@ na_factory_object_dump( const NAIFactoryObject *object )
length += 1;
for( it = list ; it ; it = it->next ){
/*na_data_boxed_dump( NA_DATA_BOXED( it->data ));*/
NADataBoxed *boxed = NA_DATA_BOXED( it->data );
NADataDef *def = na_data_boxed_get_data_def( boxed );
gchar *value = na_data_boxed_get_as_string( boxed );
g_debug( "%s: %*s=%s", thisfn, length, def->name+l_prefix, value );
g_debug( "| %s: %*s=%s", thisfn, length, def->name+l_prefix, value );
g_free( value );
}
}
......
......@@ -242,8 +242,8 @@ na_iduplicable_dispose( const NAIDuplicable *object )
if( st_initialized && !st_finalized ){
str = get_duplicable_str( object );
g_free( str );
g_object_set_data( G_OBJECT( object ), NA_IDUPLICABLE_DATA_DUPLICABLE, NULL );
}
}
......@@ -273,9 +273,9 @@ na_iduplicable_dump( const NAIDuplicable *object )
str = get_duplicable_str( object );
g_debug( "%s: origin=%p", thisfn, ( void * ) str->origin );
g_debug( "%s: modified=%s", thisfn, str->modified ? "True" : "False" );
g_debug( "%s: valid=%s", thisfn, str->valid ? "True" : "False" );
g_debug( "| %s: origin=%p", thisfn, ( void * ) str->origin );
g_debug( "| %s: modified=%s", thisfn, str->modified ? "True" : "False" );
g_debug( "| %s: valid=%s", thisfn, str->valid ? "True" : "False" );
}
}
......
......@@ -73,6 +73,7 @@ static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static void object_copy( NAObject *target, const NAObject *source, gboolean recursive );
static void object_dump( const NAObject *object );
static gboolean object_is_valid( const NAObject *object );
static void ifactory_object_iface_init( NAIFactoryObjectInterface *iface );
......@@ -168,8 +169,8 @@ class_init( NAObjectActionClass *klass )
object_class->finalize = instance_finalize;
naobject_class = NA_OBJECT_CLASS( klass );
naobject_class->dump = NULL;
naobject_class->copy = object_copy;
naobject_class->dump = object_dump;
naobject_class->are_equal = NULL;
naobject_class->is_valid = object_is_valid;
......@@ -229,9 +230,10 @@ instance_dispose( GObject *object )
self = NA_OBJECT_ACTION( object );
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
na_object_dump( object );
self->private->dispose_has_run = TRUE;
/* chain up to the parent class */
......@@ -274,6 +276,29 @@ object_copy( NAObject *target, const NAObject *source, gboolean recursive )
}
}
static void
object_dump( const NAObject *object )
{
static const char *thisfn = "na_object_action_object_dump";
NAObjectAction *self;
g_return_if_fail( NA_IS_OBJECT_ACTION( object ));
self = NA_OBJECT_ACTION( object );
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s, ref_count=%d)", thisfn,
( void * ) object, G_OBJECT_TYPE_NAME( object ), G_OBJECT( object )->ref_count );
/* chain up to the parent class */
if( NA_OBJECT_CLASS( st_parent_class )->dump ){
NA_OBJECT_CLASS( st_parent_class )->dump( object );
}
g_debug( "+- end of dump" );
}
}
static gboolean
object_is_valid( const NAObject *object )
{
......
......@@ -114,7 +114,6 @@ class_init( NAObjectIdClass *klass )
object_class->finalize = instance_finalize;
naobject_class = NA_OBJECT_CLASS( klass );
naobject_class->dump = NULL;
naobject_class->copy = NULL;
naobject_class->are_equal = NULL;
naobject_class->is_valid = object_is_valid;
......
......@@ -52,17 +52,8 @@ struct _NAObjectItemClassPrivate {
struct _NAObjectItemPrivate {
gboolean dispose_has_run;
void *provider_data;
/* dynamically set when reading the item from the I/O storage
* subsystem; may be reset from FALSE to TRUE if a write operation
* has returned an error.
* defaults to FALSE for new, not yet written to a provider, item
*/
gboolean readonly;
/* set at load time
* takes into account the above 'readonly' status as well as the i/o
* takes into account the runtime 'readonly' status as well as the i/o
* provider writability status - does not consider the level-zero case
*/
gboolean writable;
......@@ -238,7 +229,6 @@ object_copy( NAObject *target, const NAObject *source, gboolean recursive )
}
}
dest->private->readonly = src->private->readonly;
dest->private->writable = src->private->writable;
dest->private->reason = src->private->reason;
}
......@@ -256,10 +246,13 @@ object_dump( const NAObject *object )
if( !item->private->dispose_has_run ){
g_debug( "%s: provider_data=%p", thisfn, ( void * ) item->private->provider_data );
g_debug( "%s: readonly=%s", thisfn, item->private->readonly ? "True":"False" );
g_debug( "%s: writable=%s", thisfn, item->private->writable ? "True":"False" );
g_debug( "%s: reason=%u", thisfn, item->private->reason );
g_debug( "| %s: writable=%s", thisfn, item->private->writable ? "True":"False" );
g_debug( "| %s: reason=%u", thisfn, item->private->reason );
/* chain up to the parent class */
if( NA_OBJECT_CLASS( st_parent_class )->dump ){
NA_OBJECT_CLASS( st_parent_class )->dump( object );
}
}
}
......
......@@ -70,6 +70,7 @@ static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static void object_copy( NAObject *target, const NAObject *source, gboolean recursive );
static void object_dump( const NAObject *object );
static gboolean object_is_valid( const NAObject *object );
static void ifactory_object_iface_init( NAIFactoryObjectInterface *iface );
......@@ -159,8 +160,8 @@ class_init( NAObjectMenuClass *klass )
object_class->finalize = instance_finalize;
naobject_class = NA_OBJECT_CLASS( klass );
naobject_class->dump = NULL;
naobject_class->copy = object_copy;
naobject_class->dump = object_dump;
naobject_class->are_equal = NULL;
naobject_class->is_valid = object_is_valid;
......@@ -265,6 +266,29 @@ object_copy( NAObject *target, const NAObject *source, gboolean recursive )
}
}
static void
object_dump( const NAObject *object )
{
static const char *thisfn = "na_object_menu_object_dump";
NAObjectMenu *self;
g_return_if_fail( NA_IS_OBJECT_MENU( object ));
self = NA_OBJECT_MENU( object );
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s, ref_count=%d)", thisfn,
( void * ) object, G_OBJECT_TYPE_NAME( object ), G_OBJECT( object )->ref_count );
/* chain up to the parent class */
if( NA_OBJECT_CLASS( st_parent_class )->dump ){
NA_OBJECT_CLASS( st_parent_class )->dump( object );
}
g_debug( "+- end of dump" );
}
}
static gboolean
object_is_valid( const NAObject *object )
{
......
......@@ -74,6 +74,7 @@ static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static void object_copy( NAObject *target, const NAObject *source, gboolean recursive );
static void object_dump( const NAObject *object );
static gboolean object_is_valid( const NAObject *object );
static void ifactory_object_iface_init( NAIFactoryObjectInterface *iface );
......@@ -169,8 +170,8 @@ class_init( NAObjectProfileClass *klass )
object_class->finalize = instance_finalize;
naobject_class = NA_OBJECT_CLASS( klass );
naobject_class->dump = NULL;
naobject_class->copy = object_copy;
naobject_class->dump = object_dump;
naobject_class->are_equal = NULL;
naobject_class->is_valid = object_is_valid;
......@@ -280,6 +281,29 @@ object_copy( NAObject *target, const NAObject *source, gboolean recursive )
}
}
static void
object_dump( const NAObject *object )
{
static const char *thisfn = "na_object_profile_object_dump";
NAObjectProfile *self;
g_return_if_fail( NA_IS_OBJECT_PROFILE( object ));
self = NA_OBJECT_PROFILE( object );
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s, ref_count=%d)", thisfn,
( void * ) object, G_OBJECT_TYPE_NAME( object ), G_OBJECT( object )->ref_count );
/* chain up to the parent class */
if( NA_OBJECT_CLASS( st_parent_class )->dump ){
NA_OBJECT_CLASS( st_parent_class )->dump( object );
}
g_debug( "+- end of dump" );
}
}
static gboolean
object_is_valid( const NAObject *object )
{
......
......@@ -86,7 +86,6 @@ static gboolean iduplicable_is_valid_iter( GObjectClass *class, const NAObject *
static void check_status_down_rec( const NAObject *object );
static void check_status_up_rec( const NAObject *object, gboolean was_modified, gboolean was_valid );
static gboolean object_copy_iter( GObjectClass *class, const NAObject *source, CopyIter *data );
static gboolean dump_class_hierarchy_iter( GObjectClass *class, const NAObject *object, void *user_data );
static void dump_tree( GList *tree, gint level );
static void iter_on_class_hierarchy( const NAObject *object, HierarchyIterFunc pfn, void *user_data );
static GList *build_class_hierarchy( const NAObject *object );
......@@ -152,14 +151,12 @@ class_init( NAObjectClass *klass )
object_class->finalize = instance_finalize;
naobject_class = NA_OBJECT_CLASS( klass );
naobject_class->dump = NULL;
naobject_class->dump = object_dump;
naobject_class->copy = NULL;
naobject_class->are_equal = NULL;
naobject_class->is_valid = NULL;
klass->private = g_new0( NAObjectClassPrivate, 1 );
klass->dump = object_dump;
}
static void
......@@ -189,7 +186,6 @@ instance_dispose( GObject *object )
self = NA_OBJECT( object );
if( !self->private->dispose_has_run ){
g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
self->private->dispose_has_run = TRUE;
......@@ -230,15 +226,13 @@ instance_finalize( GObject *object )
static void
object_dump( const NAObject *object )
{
static const char *thisfn = "na_object_do_dump";
g_debug( "%s: object=%p (%s, ref_count=%d)", thisfn,
( void * ) object, G_OBJECT_TYPE_NAME( object ), G_OBJECT( object )->ref_count );
if( !object->private->dispose_has_run ){
na_iduplicable_dump( NA_IDUPLICABLE( object ));
na_iduplicable_dump( NA_IDUPLICABLE( object ));
if( NA_IS_IFACTORY_OBJECT( object )){
na_factory_object_dump( NA_IFACTORY_OBJECT( object ));
if( NA_IS_IFACTORY_OBJECT( object )){
na_factory_object_dump( NA_IFACTORY_OBJECT( object ));
}
}
}
......@@ -516,10 +510,9 @@ na_object_object_dump( const NAObject *object )
na_object_dump_norec( object );
if( NA_IS_OBJECT_ITEM( object )){
children = na_object_get_items( object );
for( ic = children ; ic ; ic = ic->next ){
for( ic = children ; ic ; ic = ic->next ){
na_object_dump( ic->data );
}
}
......@@ -542,21 +535,10 @@ na_object_object_dump_norec( const NAObject *object )
g_return_if_fail( NA_IS_OBJECT( object ));
if( !object->private->dispose_has_run ){
iter_on_class_hierarchy( object, ( HierarchyIterFunc ) &dump_class_hierarchy_iter, NULL );
}
}
static gboolean
dump_class_hierarchy_iter( GObjectClass *class, const NAObject *object, void *user_data )
{
gboolean stop = FALSE;
if( NA_OBJECT_CLASS( class )->dump ){
NA_OBJECT_CLASS( class )->dump( object );
if( NA_OBJECT_GET_CLASS( object )->dump ){
NA_OBJECT_GET_CLASS( object )->dump( object );
}
}
return( stop );
}
/**
......
......@@ -1230,3 +1230,24 @@ record_connected_signal( BaseWindow *window, GObject *instance, gulong handler_i
g_debug( "%s: connecting signal handler %p:%lu", thisfn, ( void * ) instance, handler_id );
}
}
void
base_window_signal_disconnect( BaseWindow *window, gulong handler_id )
{
GList *it;
g_return_if_fail( BASE_IS_WINDOW( window ));
if( !window->private->dispose_has_run ){
for( it = window->private->signals ; it ; it = it->next ){
RecordedSignal *str = ( RecordedSignal * ) it->data;
if( str->handler_id == handler_id ){
g_signal_handler_disconnect( str->instance, str->handler_id );
window->private->signals = g_list_delete_link( window->private->signals, it );
g_free( str );
}
}
}
}
......@@ -241,6 +241,7 @@ gulong base_window_signal_connect ( BaseWindow *window, GObje
gulong base_window_signal_connect_after ( BaseWindow *window, GObject *instance, const gchar *signal, GCallback fn );
gulong base_window_signal_connect_by_name ( BaseWindow *window, const gchar *name, const gchar *signal, GCallback fn );
gulong base_window_signal_connect_with_data( BaseWindow *window, GObject *instance, const gchar *signal, GCallback fn, void *user_data );
void base_window_signal_disconnect ( BaseWindow *window, gulong handler_id );
G_END_DECLS
......
......@@ -230,6 +230,8 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
g_object_unref( self->private->items_view );
if( self->private->selected_items ){
self->private->selected_items = na_object_free_items( self->private->selected_items );
}
......
......@@ -382,7 +382,8 @@ on_main_selection_changed( NactIActionTab *instance, GList *selected_items, gpoi
if( st_initialized && !st_finalized ){
count_selected = g_list_length( selected_items );
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_debug( "%s: instance=%p, selected_items=%p (count=%u)",
thisfn, ( void * ) instance, ( void * ) selected_items, count_selected );
enable_tab = ( count_selected == 1 );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ACTION, enable_tab );
......
......@@ -141,7 +141,7 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
}
toolbar = gtk_ui_manager_get_widget( ui_manager, props->ui_path );
g_debug( "%s: toolbar=%p, path=%s, ref=%d", thisfn, ( void * ) toolbar, props->ui_path, G_OBJECT( toolbar )->ref_count );
g_debug( "%s: toolbar=%p, path=%s, ref_count=%d", thisfn, ( void * ) toolbar, props->ui_path, G_OBJECT( toolbar )->ref_count );
hbox = base_window_get_widget( BASE_WINDOW( window ), "ToolbarHBox" );
if( is_active ){
......@@ -157,7 +157,6 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
gtk_container_add( GTK_CONTAINER( hbox ), handle );
reorder_toolbars( GTK_HBOX( hbox ), toolbar_id, handle );
gtk_widget_show_all( handle );
g_debug( "%s: ref=%d", thisfn, G_OBJECT( toolbar )->ref_count );
} else {
handle = ( GtkWidget * ) g_object_get_data( G_OBJECT( toolbar ), "nact-main-toolbar-handle" );
......@@ -167,7 +166,6 @@ nact_main_toolbar_activate( NactMainWindow *window, int toolbar_id, GtkUIManager
g_signal_handler_disconnect( handle, attach_id );
gtk_container_remove( GTK_CONTAINER( handle ), toolbar );
gtk_container_remove( GTK_CONTAINER( hbox ), handle );
g_debug( "%s: ref=%d", thisfn, G_OBJECT( toolbar )->ref_count );
}
application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
......
......@@ -119,8 +119,8 @@ struct _NactMainWindowPrivate {
* Some convenience objects and data.
*/
NactTreeView *items_view;
gboolean is_tree_modified;
NactClipboard *clipboard;
guint count_modified;
};
/* properties set against the main window
......@@ -179,7 +179,7 @@ static void on_base_initialize_gtk_toplevel( NactMainWindow *window, GtkWind
static void on_base_initialize_base_window( NactMainWindow *window, gpointer user_data );
static void on_base_all_widgets_showed( NactMainWindow *window, gpointer user_data );
static void on_tree_view_modified_count_changed( NactMainWindow *window, guint count, gpointer user_data );
static void on_tree_view_modified_status_changed( NactMainWindow *window, gboolean is_modified, gpointer user_data );
static void on_tree_view_selection_changed( NactMainWindow *window, GList *selected_items, gpointer user_data );
static void on_selection_changed_cleanup_handler( BaseWindow *window, GList *selected_items );
static void raz_selection_properties( NactMainWindow *window );
......@@ -352,22 +352,22 @@ class_init( NactMainWindowClass *klass )
g_object_class_install_property( object_class, MAIN_PROP_ITEM_ID,
g_param_spec_pointer(
MAIN_PROP_ITEM,
"Edited NAObjectItem",
"A pointer to the edited NAObjectItem, an action or a menu",
"Current NAObjectItem",
"A pointer to the currently edited NAObjectItem, an action or a menu",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
g_object_class_install_property( object_class, MAIN_PROP_PROFILE_ID,
g_param_spec_pointer(
MAIN_PROP_PROFILE,
"Edited NAObjectProfile",
"A pointer to the edited NAObjectProfile",
"Current NAObjectProfile",
"A pointer to the currently edited NAObjectProfile",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
g_object_class_install_property( object_class, MAIN_PROP_CONTEXT_ID,
g_param_spec_pointer(
MAIN_PROP_CONTEXT,
"Current NAIContext",
"The currently edited NAIContext",
"A pointer to the currently edited NAIContext",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
g_object_class_install_property( object_class, MAIN_PROP_EDITABLE_ID,
......@@ -432,24 +432,6 @@ class_init( NactMainWindowClass *klass )
G_TYPE_POINTER,
G_TYPE_BOOLEAN );
/**
* main-window-level-zero-order-changed:
*
* This signal is emitted each time a user interaction may led the
* action sensitivities to be updated.
*/
st_signals[ ORDER_CHANGED ] = g_signal_new(
MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED,
G_TYPE_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* no default handler */
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1,
G_TYPE_POINTER );
/**
* NactMainWindow::main-selection-changed:
*
......@@ -709,7 +691,7 @@ instance_constructed( GObject *window )
G_OBJECT( window ), TREE_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_tree_view_selection_changed ));
base_window_signal_connect( BASE_WINDOW( window ),
G_OBJECT( window ), TREE_SIGNAL_MODIFIED_COUNT_CHANGED, G_CALLBACK( on_tree_view_modified_count_changed ));
G_OBJECT( window ), TREE_SIGNAL_MODIFIED_STATUS_CHANGED, G_CALLBACK( on_tree_view_modified_status_changed ));
/* create the menubar
* it will create itself toolbar and statusbar
......@@ -743,6 +725,7 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
g_object_unref( self->private->items_view );
g_object_unref( self->private->clipboard );
settings = na_pivot_get_settings( NA_PIVOT( self->private->updater ));
......@@ -989,19 +972,19 @@ nact_main_window_reload( NactMainWindow *window )
}
/*
* the count of modified NAObjectItem has changed
* the modification status of the items view has changed
*/
static void
on_tree_view_modified_count_changed( NactMainWindow *window, guint count, gpointer user_data )
on_tree_view_modified_status_changed( NactMainWindow *window, gboolean is_modified, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_tree_view_modified_count_changed";
static const gchar *thisfn = "nact_main_window_on_tree_view_modified_status_changed";
g_debug( "%s: window=%p, count=%d, user_data=%p",
thisfn, ( void * ) window, count, ( void * ) user_data );
g_debug( "%s: window=%p, is_modified=%s, user_data=%p",
thisfn, ( void * ) window, is_modified ? "True":"False", ( void * ) user_data );
if( !window->private->dispose_has_run ){
window->private->count_modified = count;
window->private->is_tree_modified = is_modified;
setup_dialog_title( window );
}
}
......@@ -1043,7 +1026,7 @@ on_tree_view_selection_changed( NactMainWindow *window, GList *selected_items, g
static void
on_selection_changed_cleanup_handler( BaseWindow *window, GList *selected_items )
{
static const gchar *thisfn = "nact_mainw_window_on_selection_changed_cleanup_handler";
static const gchar *thisfn = "nact_main_window_on_selection_changed_cleanup_handler";
g_debug( "%s: window=%p, selected_items=%p (count=%u)",
thisfn, ( void * ) window,
......@@ -1124,7 +1107,7 @@ setup_dialog_title( NactMainWindow *window )
title = tmp;
}
if( window->private->count_modified > 0 ){
if( window->private->is_tree_modified ){
tmp = g_strdup_printf( "*%s", title );
g_free( title );
title = tmp;
......@@ -1185,7 +1168,7 @@ confirm_for_giveup_from_pivot( const NactMainWindow *window )
"You could keep to work with your current list of actions, "
"or you may want to reload a fresh one." ));
if( window->private->count_modified > 0 ){
if( window->private->is_tree_modified){
gchar *tmp = g_strdup_printf( "%s\n\n%s", first,
_( "Note that reloading a fresh list of actions requires "
......@@ -1214,7 +1197,7 @@ confirm_for_giveup_from_menu( const NactMainWindow *window )
gboolean reload_ok = TRUE;
gchar *first, *second;
if( window->private->count_modified > 0 ){
if( window->private->is_tree_modified ){
first = g_strdup(
_( "Reloading a fresh list of actions requires "
......@@ -1269,7 +1252,7 @@ nact_main_window_quit( NactMainWindow *window )
if( !window->private->dispose_has_run ){
g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
if( window->private->count_modified == 0 || warn_modified( window )){
if( !window->private->is_tree_modified || warn_modified( window )){
g_object_unref( window );
terminated = TRUE;
}
......@@ -1287,7 +1270,8 @@ base_is_willing_to_quit( const BaseWindow *window )
g_debug( "%s: window=%p", thisfn, ( void * ) window );
willing_to = TRUE;
if( NACT_MAIN_WINDOW( window )->private->count_modified > 0 ){
if( NACT_MAIN_WINDOW( window )->private->is_tree_modified ){
willing_to = nact_confirm_logout_run( NACT_MAIN_WINDOW( window ));
}
......@@ -1532,8 +1516,7 @@ on_settings_order_mode_changed( const gchar *group, const gchar *key, gconstpoin
tree = na_pivot_get_items( NA_PIVOT( window->private->updater ));
if( g_list_length( tree )){
g_signal_emit_by_name( window,
MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED, GINT_TO_POINTER( TRUE ));
g_signal_emit_by_name( window, TREE_SIGNAL_LEVEL_ZERO_CHANGED );
}
}
}
......
......@@ -163,8 +163,6 @@ typedef struct {
#define MAIN_PROP_EDITABLE "main-editable"
#define MAIN_PROP_REASON "main-reason"
#define MAIN_WINDOW_SIGNAL_LEVEL_ZERO_ORDER_CHANGED "main-window-level-zero-order-changed"
GType nact_main_window_get_type( void );
NactMainWindow *nact_main_window_new ( const NactApplication *application );
......
......@@ -225,7 +225,7 @@ nact_menubar_edit_on_cut( GtkAction *gtk_action, BaseWindow *window )
nact_clipboard_primary_set( clipboard, to_delete, CLIPBOARD_MODE_CUT );
update_clipboard_counters( window );
view = nact_main_window_get_items_view( NACT_MAIN_WINDOW( window ));
nact_tree_ieditable_delete( NACT_TREE_IEDITABLE( view ), to_delete, TRUE );
nact_tree_ieditable_delete( NACT_TREE_IEDITABLE( view ), to_delete, TREE_OPE_DELETE );
}
na_object_free_items( items );
......@@ -473,7 +473,7 @@ nact_menubar_edit_on_delete( GtkAction *gtk_action, BaseWindow *window )
if( to_delete ){
view = nact_main_window_get_items_view( NACT_MAIN_WINDOW( window ));
nact_tree_ieditable_delete( NACT_TREE_IEDITABLE( view ), to_delete, TRUE );
nact_tree_ieditable_delete( NACT_TREE_IEDITABLE( view ), to_delete, TREE_OPE_DELETE );
}
na_object_free_items( items );
......
......@@ -104,7 +104,7 @@ nact_menubar_file_on_update_sensitivities( const NactMenubar *bar )
/* save enabled if at least one item has been modified
* or level-zero has been resorted and is writable
*/
nact_menubar_enable_item( bar, "SaveItem", ( bar->private->count_modified > 0 ));
nact_menubar_enable_item( bar, "SaveItem", ( bar->private->is_tree_modified ));
/* quit always enabled */
}
......@@ -290,8 +290,6 @@ nact_menubar_file_save_items( BaseWindow *window )
return;
}
bar->private->level_zero_order_changed = FALSE;
/* remove deleted items
* so that new actions with same id do not risk to be deleted later
*/
......@@ -344,12 +342,7 @@ nact_menubar_file_save_items( BaseWindow *window )
na_pivot_set_new_items( NA_PIVOT( bar->private->updater ), g_list_reverse( new_pivot ));
g_list_free( items );
/* when new_pivot is empty, then there has been no chance of updating
* sensibilities on check status - so force it there
*/
if( !new_pivot ){
g_signal_emit_by_name( bar, MENUBAR_SIGNAL_UPDATE_SENSITIVITIES );
}
g_signal_emit_by_name( window, TREE_SIGNAL_MODIFIED_STATUS_CHANGED, FALSE );
}
/*
......
......@@ -73,10 +73,10 @@ struct _NactMenubarPrivate {
gboolean is_action_writable;
gboolean are_parents_writable; /* cut/delete */
/* set when the count of modified NAObjectItem changes
* this is a NactTreeIEditable-driven count
/* set when the count of modified or deleted NAObjectItem changes
* or when the lever zero is changed
*/
guint count_modified;
gboolean is_tree_modified;
/* set on focus in/out
*/
......@@ -100,7 +100,6 @@ struct _NactMenubarPrivate {
gint clipboard_menus;
gint clipboard_actions;
gint clipboard_profiles;
gboolean level_zero_order_changed;
/* *** */
};
......
......@@ -224,21 +224,16 @@ static void on_menu_item_deselected( GtkMenuItem *proxy, BaseWindow *window
static void on_tree_view_open_context_menu( BaseWindow *window, GdkEventButton *event, gpointer user_data );
static void on_popup_selection_done( GtkMenuShell *menushell, BaseWindow *window );
static void on_tree_view_count_changed( BaseWindow *window, gboolean reset, guint menus, guint actions, guint profiles );
static void on_tree_view_count_changed( BaseWindow *window, gboolean reset, gint menus, gint actions, gint profiles );
static void on_tree_view_focus_in( BaseWindow *window, gpointer user_data );
static void on_tree_view_focus_out( BaseWindow *window, gpointer user_data );
static void on_tree_view_modified_count_changed( BaseWindow *window, guint count, gpointer user_data );
static void on_tree_view_modified_status_changed( BaseWindow *window, gboolean is_modified, gpointer user_data );
static void on_tree_view_selection_changed( BaseWindow *window, GList *selected, gpointer user_data );
static void on_update_sensitivities( NactMenubar *bar, BaseWindow *window );
static void on_finalizing_window( NactMenubar *bar, GObject *window );
#if 0
static void on_iactions_list_status_changed( BaseWindow *window, gpointer user_data );
static void on_level_zero_order_changed( BaseWindow *window, gpointer user_data );
#endif
GType