[nautilus-actions] Add g_return_if_fail checks on data and context
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Add g_return_if_fail checks on data and context
- Date: Tue, 27 Jul 2010 21:47:28 +0000 (UTC)
commit d0ee9d8ceffa49d718427a97f0ff5e6b3aeebdac
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Jul 26 21:57:40 2010 +0200
Add g_return_if_fail checks on data and context
ChangeLog | 3 ++
src/nact/nact-match-list.c | 66 ++++++++++++++++++++++---------------------
2 files changed, 37 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d6d5e3c..a73ff5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-07-26 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-match-list.c (on_filter_edited):
+ Add g_return_if_fail checks on data and context.
+
Prevent of inline edition of capabilities.
* src/nact/nact-match-list.c:
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index 06384f4..22405ef 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -397,11 +397,11 @@ nact_match_list_get_rows( BaseWindow *window, const gchar *tab_name )
MatchListStr *data;
GtkTreeModel *model;
- filters = NULL;
data = ( MatchListStr * ) g_object_get_data( G_OBJECT( window ), tab_name );
g_return_val_if_fail( data != NULL, NULL );
model = gtk_tree_view_get_model( data->listview );
+ filters = NULL;
gtk_tree_model_foreach( model, ( GtkTreeModelForeachFunc ) get_rows_iter, &filters );
return( filters );
@@ -470,47 +470,49 @@ on_filter_edited( GtkCellRendererText *renderer, const gchar *path_str, const gc
gchar *to_add, *to_remove;
GSList *filters;
- context = nact_main_tab_get_context( NACT_MAIN_WINDOW( data->window ), NULL );
+ g_return_if_fail( data->editable_filter );
- if( context ){
- model = gtk_tree_view_get_model( data->listview );
- path = gtk_tree_path_new_from_string( path_str );
- gtk_tree_model_get_iter( model, &iter, path );
- gtk_tree_path_free( path );
+ context = nact_main_tab_get_context( NACT_MAIN_WINDOW( data->window ), NULL );
+ g_return_if_fail( context && NA_IS_ICONTEXT( context ));
- gtk_tree_model_get( model, &iter,
- ITEM_COLUMN, &old_text,
- MUST_MATCH_COLUMN, &must_match,
- MUST_NOT_MATCH_COLUMN, &must_not_match,
- -1 );
+ model = gtk_tree_view_get_model( data->listview );
- gtk_list_store_set( GTK_LIST_STORE( model ), &iter, ITEM_COLUMN, text, -1 );
+ path = gtk_tree_path_new_from_string( path_str );
+ gtk_tree_model_get_iter( model, &iter, path );
+ gtk_tree_path_free( path );
- filters = ( *data->pget )( context );
+ gtk_tree_model_get( model, &iter,
+ ITEM_COLUMN, &old_text,
+ MUST_MATCH_COLUMN, &must_match,
+ MUST_NOT_MATCH_COLUMN, &must_not_match,
+ -1 );
- if( filters ){
- to_remove = g_strdup( old_text );
- filters = na_core_utils_slist_remove_ascii( filters, to_remove );
- g_free( to_remove );
- to_remove = g_strdup_printf( "!%s", old_text );
- filters = na_core_utils_slist_remove_ascii( filters, to_remove );
- g_free( to_remove );
- }
+ gtk_list_store_set( GTK_LIST_STORE( model ), &iter, ITEM_COLUMN, text, -1 );
- if( must_match ){
- filters = g_slist_prepend( filters, g_strdup( text ));
+ filters = ( *data->pget )( context );
- } else if( must_not_match ){
- to_add = g_strdup_printf( "!%s", text );
- filters = g_slist_prepend( filters, to_add );
- }
+ if( filters ){
+ to_remove = g_strdup( old_text );
+ filters = na_core_utils_slist_remove_ascii( filters, to_remove );
+ g_free( to_remove );
+ to_remove = g_strdup_printf( "!%s", old_text );
+ filters = na_core_utils_slist_remove_ascii( filters, to_remove );
+ g_free( to_remove );
+ }
- ( *data->pset )( context, filters );
- na_core_utils_slist_free( filters );
- g_free( old_text );
+ if( must_match ){
+ filters = g_slist_prepend( filters, g_strdup( text ));
- g_signal_emit_by_name( G_OBJECT( data->window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, context, FALSE );
+ } else if( must_not_match ){
+ to_add = g_strdup_printf( "!%s", text );
+ filters = g_slist_prepend( filters, to_add );
}
+
+ ( *data->pset )( context, filters );
+ na_core_utils_slist_free( filters );
+ g_free( old_text );
+
+ g_signal_emit_by_name( G_OBJECT( data->window ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, context, FALSE );
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]