[nautilus-actions] Remove count_all_items_of_treestore functions



commit 11dea396578dd2c285c41e1b75c8d3cdbabaea12
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Sep 18 22:55:11 2009 +0200

    Remove count_all_items_of_treestore functions
    
    To be replaced by just a boolean 'is_tree_empty'

 ChangeLog                     |   10 ++++++++
 src/nact/nact-iactions-list.c |   24 -------------------
 src/nact/nact-iactions-list.h |    1 -
 src/nact/nact-main-menubar.c  |    7 +++--
 src/nact/nact-main-window.c   |   15 ------------
 src/nact/nact-main-window.h   |    1 -
 src/nact/nact-tree-model.c    |   50 -----------------------------------------
 src/nact/nact-tree-model.h    |    1 -
 8 files changed, 14 insertions(+), 95 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 51a4e49..a52eb78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,10 +44,20 @@
 	nact_tree_model_update_parent(): removed function.
 
 	* src/nact/nact-iactions-list.c:
+	* src/nact/nact-iactions-list.h:
 	Set selection on last level 1 inserted row.
+	nact_iactions_list_get_items_count: Removed function.
 
 	* src/nact/nact-main-menubar.c (on_new_profile_activated): Fixed.
 
+	* src/nact/nact-main-window.c:
+	* src/nact/nact-main-window.h (nact_main_window_get_all_items_count):
+	Removed function.
+
+	* src/nact/nact-tree-model.c:
+	* src/nact/nact-tree-model.h (nact_tree_model_get_items_count):
+	Removed function.
+
 	* src/nact/nact-window.c:
 	* src/nact/nact-window.h (nact_window_count_level_zero_items):
 	New	function.
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 49d4051..b49c9d3 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -511,30 +511,6 @@ nact_iactions_list_get_items( NactIActionsList *instance )
 }
 
 /**
- * nact_iactions_list_get_items_count:
- * @window: this #NactIActionsList instance.
- *
- * Returns: the current count of items in the list, whether they are
- * currently visible or not.
- */
-guint
-nact_iactions_list_get_items_count( NactIActionsList *instance )
-{
-	GtkTreeView *treeview;
-	NactTreeModel *model;
-
-	g_return_val_if_fail( NACT_IS_IACTIONS_LIST( instance ), 0 );
-
-	treeview = get_actions_list_treeview( instance );
-
-	model = NACT_TREE_MODEL( gtk_tree_view_get_model( treeview ));
-
-	g_return_val_if_fail( NACT_IS_TREE_MODEL( model ), 0 );
-
-	return( nact_tree_model_get_items_count( model ));
-}
-
-/**
  * nact_iactions_list_get_modified_items:
  * @window: this #NactIActionsList instance.
  *
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index 3cf4ba3..a949a2a 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -79,7 +79,6 @@ void      nact_iactions_list_dispose( NactIActionsList *instance );
 void      nact_iactions_list_delete_selection( NactIActionsList *instance, GtkTreePath **path );
 void      nact_iactions_list_fill( NactIActionsList *instance, GList *items );
 GList    *nact_iactions_list_get_items( NactIActionsList *instance );
-guint     nact_iactions_list_get_items_count( NactIActionsList *instance );
 GList    *nact_iactions_list_get_modified_items( NactIActionsList *instance );
 GList    *nact_iactions_list_get_selected_items( NactIActionsList *instance );
 void      nact_iactions_list_insert_items( NactIActionsList *instance, GList *items );
diff --git a/src/nact/nact-main-menubar.c b/src/nact/nact-main-menubar.c
index 630db6e..d323003 100644
--- a/src/nact/nact-main-menubar.c
+++ b/src/nact/nact-main-menubar.c
@@ -664,7 +664,7 @@ refresh_actions_sensitivity_with_count( NactMainWindow *window, gint count_selec
 	static const gchar *thisfn = "nact_main_menubar_refresh_actions_sensitivity_with_count";
 	NAObjectItem *item;
 	NAObjectProfile *profile;
-	guint count_all;
+	/*guint count_all;*/
 	guint count_modified;
 	gboolean is_clipboard_empty;
 
@@ -677,7 +677,8 @@ refresh_actions_sensitivity_with_count( NactMainWindow *window, gint count_selec
 			TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
 			NULL );
 
-	count_all = nact_main_window_get_all_items_count( window );
+	/* TODO: replace count_all by is_empty */
+	/*count_all = nact_main_window_get_all_items_count( window );*/
 	count_modified = nact_main_window_get_modified_items_count( window );
 	is_clipboard_empty = nact_clipboard_is_empty();
 
@@ -700,7 +701,7 @@ refresh_actions_sensitivity_with_count( NactMainWindow *window, gint count_selec
 	/* preferences always enabled */
 	/* import item always enabled */
 	/* export item enabled if IActionsList not empty */
-	enable_item( window, "ExportItem", count_all > 0 );
+	enable_item( window, "ExportItem", FALSE /*count_all > 0*/ );
 	/* TODO: help temporarily disabled */
 	enable_item( window, "HelpItem", FALSE );
 	/* about always enabled */
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 601c13e..1284ff3 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -554,21 +554,6 @@ nact_main_window_action_exists( const NactMainWindow *window, const gchar *uuid
 }
 
 /**
- * nact_main_window_get_all_items_count:
- * @window: this #NactMainWindow instance.
- *
- * Returns: the current total count of items in the view.
- */
-guint
-nact_main_window_get_all_items_count( const NactMainWindow *window )
-{
-	g_return_val_if_fail( NACT_IS_MAIN_WINDOW( window ), 0 );
-	g_return_val_if_fail( NACT_IS_IACTIONS_LIST( window ), 0 );
-
-	return( nact_iactions_list_get_items_count( NACT_IACTIONS_LIST( window )));
-}
-
-/**
  * nact_main_window_get_modified_items_count:
  * @window: this #NactMainWindow instance.
  *
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index 06f2971..0fe2c48 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -69,7 +69,6 @@ GType           nact_main_window_get_type( void );
 NactMainWindow *nact_main_window_new( BaseApplication *application );
 
 gboolean        nact_main_window_action_exists( const NactMainWindow *window, const gchar *uuid );
-guint           nact_main_window_get_all_items_count( const NactMainWindow *window );
 guint           nact_main_window_get_modified_items_count( const NactMainWindow *window );
 void            nact_main_window_move_to_deleted( NactMainWindow *window, GList *items );
 void            nact_main_window_remove_deleted( NactMainWindow *window );
diff --git a/src/nact/nact-tree-model.c b/src/nact/nact-tree-model.c
index 5f3f685..d0f0d98 100644
--- a/src/nact/nact-tree-model.c
+++ b/src/nact/nact-tree-model.c
@@ -78,7 +78,6 @@ struct NactTreeModelPrivate {
 	gboolean     dispose_has_run;
 	BaseWindow  *window;
 	GtkTreeView *treeview;
-	guint        count;
 	gboolean     have_dnd;
 	gchar       *drag_dest_uri;
 	GList       *drag_items;
@@ -166,8 +165,6 @@ static gboolean       idrag_dest_row_drop_possible( GtkTreeDragDest *drag_dest,
 
 static gboolean       on_drag_begin( GtkWidget *widget, GdkDragContext *context, BaseWindow *window );
 static void           on_drag_end( GtkWidget *widget, GdkDragContext *context, BaseWindow *window );
-static void           on_row_deleted( GtkTreeModel *tree_model, GtkTreePath *path, NactTreeModel *model );
-static void           on_row_inserted( GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, NactTreeModel *model );
 
 /*static gboolean       on_drag_drop( GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, BaseWindow *window );
 static void           on_drag_data_received( GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, BaseWindow *window );*/
@@ -285,7 +282,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	self->private = g_new0( NactTreeModelPrivate, 1 );
 
 	self->private->dispose_has_run = FALSE;
-	self->private->count = 0;
 }
 
 static void
@@ -433,7 +429,6 @@ void
 nact_tree_model_runtime_init( NactTreeModel *model, gboolean have_dnd )
 {
 	static const gchar *thisfn = "nact_tree_model_runtime_init";
-	GtkTreeModel *ts_model;
 
 	g_debug( "%s: model=%p, have_dnd=%s", thisfn, ( void * ) model, have_dnd ? "True":"False" );
 	g_return_if_fail( NACT_IS_TREE_MODEL( model ));
@@ -469,20 +464,6 @@ nact_tree_model_runtime_init( NactTreeModel *model, gboolean have_dnd )
 				"drag_data-received",
 				G_CALLBACK( on_drag_data_received ));*/
 	}
-
-	ts_model = gtk_tree_model_filter_get_model( GTK_TREE_MODEL_FILTER( model ));
-
-	g_signal_connect(
-			G_OBJECT( ts_model ),
-			"row-deleted",
-			G_CALLBACK( on_row_deleted ),
-			model );
-
-	g_signal_connect(
-			G_OBJECT( ts_model ),
-			"row-inserted",
-			G_CALLBACK( on_row_inserted ),
-			model );
 }
 
 void
@@ -607,21 +588,6 @@ fill_tree_store( GtkTreeStore *model, GtkTreeView *treeview,
 }
 
 /**
- * nact_tree_model_get_items_count:
- * @model: this #NactTreeModel instance.
- *
- * Returns: the total count of rows, whether they are currently visible
- * or not.
- */
-guint
-nact_tree_model_get_items_count( NactTreeModel *model )
-{
-	g_return_val_if_fail( NACT_IS_TREE_MODEL( model ), 0 );
-
-	return( model->private->count );
-}
-
-/**
  * nact_tree_model_insert:
  * @model: this #NactTreeModel instance.
  * @object: a #NAObject-derived object to be inserted.
@@ -1195,22 +1161,6 @@ on_drag_data_received( GtkWidget *widget, GdkDragContext *drag_context, gint x,
 			thisfn, ( void * ) widget, ( void * ) drag_context, x, y, ( void * ) data, info, time, ( void * ) window );
 }*/
 
-static void
-on_row_deleted( GtkTreeModel *tree_model, GtkTreePath *path, NactTreeModel *model )
-{
-	g_return_if_fail( NACT_IS_TREE_MODEL( model ));
-
-	model->private->count -= 1;
-}
-
-static void
-on_row_inserted( GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, NactTreeModel *model )
-{
-	g_return_if_fail( NACT_IS_TREE_MODEL( model ));
-
-	model->private->count += 1;
-}
-
 static gint
 sort_actions_list( GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, BaseWindow *window )
 {
diff --git a/src/nact/nact-tree-model.h b/src/nact/nact-tree-model.h
index 5afd5dc..8618655 100644
--- a/src/nact/nact-tree-model.h
+++ b/src/nact/nact-tree-model.h
@@ -93,7 +93,6 @@ void    nact_tree_model_dispose( NactTreeModel *model );
 
 void    nact_tree_model_dump( NactTreeModel *model );
 void    nact_tree_model_fill( NactTreeModel *model, GList *items, gboolean only_actions);
-guint   nact_tree_model_get_items_count( NactTreeModel *model );
 void    nact_tree_model_insert( NactTreeModel *model, const NAObject *object, GtkTreePath *path, GtkTreeIter *iter, NAObject **parent );
 void    nact_tree_model_iter( NactTreeModel *model, FnIterOnStore fn, gpointer user_data );
 void    nact_tree_model_remove( NactTreeModel *model, GList *selected );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]