[nautilus-actions] Fix segfault on reload
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix segfault on reload
- Date: Sat, 16 Jan 2010 21:01:04 +0000 (UTC)
commit ae5fb03f844c63e7bbd72ada2cdfe28a11b37324
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jan 15 20:00:32 2010 +0100
Fix segfault on reload
ChangeLog | 10 ++++++++++
nautilus-actions/nact/nact-iactions-list-bis.c | 19 +++++++++++++++++++
nautilus-actions/nact/nact-iactions-list.c | 2 ++
nautilus-actions/nact/nact-iactions-list.h | 1 +
nautilus-actions/nact/nact-main-menubar.c | 3 +--
nautilus-actions/nact/nact-main-window.c | 2 ++
6 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de86a02..b14babc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-01-15 Pierre Wieser <pwieser trychlos org>
+ * nautilus-actions/nact/nact-iactions-list-bis.c:
+ * nautilus-actions/nact/nact-iactions-list.h
+ (nact_iactions_list_bis_clear_selection): New function.
+
+ * nautilus-actions/nact/nact-iactions-list.c (nact_iactions_list_fill):
+ Clear the selection before filling the tree view.
+
+ * nautilus-actions/nact/nact-main-menubar.c (on_update_sensitivities):
+ Force the count of selected items to be consistant with the list.
+
* nautilus-actions/nact/nact-tree-model-dnd.c (drop_inside):
Dropped new item is set as new.
diff --git a/nautilus-actions/nact/nact-iactions-list-bis.c b/nautilus-actions/nact/nact-iactions-list-bis.c
index 4c11968..b82b281 100644
--- a/nautilus-actions/nact/nact-iactions-list-bis.c
+++ b/nautilus-actions/nact/nact-iactions-list-bis.c
@@ -90,6 +90,22 @@ static void toggle_collapse_row( GtkTreeView *treeview, GtkTreePath *pat
static void update_parents_edition_status( GList *parents, GList *items );
/**
+ * nact_iactions_list_bis_clear_selection:
+ * @instance: this instance of the #NactIActionsList interface.
+ * @treeview: the #GtkTreeView.
+ *
+ * Clears the current selection.
+ */
+void
+nact_iactions_list_bis_clear_selection( NactIActionsList *instance, GtkTreeView *treeview )
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection( treeview );
+ gtk_tree_selection_unselect_all( selection );
+}
+
+/**
* nact_iactions_list_bis_collapse_to_parent:
* @instance: this instance of the #NactIActionsList interface.
*
@@ -587,10 +603,13 @@ nact_iactions_list_bis_removed_modified( NactIActionsList *instance )
void
nact_iactions_list_bis_select_first_row( NactIActionsList *instance )
{
+ static const gchar *thisfn = "nact_iactions_list_bis_select_first_row";
GtkTreeView *treeview;
GtkTreeModel *model;
GtkTreePath *path;
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
treeview = nact_iactions_list_priv_get_actions_list_treeview( instance );
model = gtk_tree_view_get_model( treeview );
diff --git a/nautilus-actions/nact/nact-iactions-list.c b/nautilus-actions/nact/nact-iactions-list.c
index 3a015e6..a0afb10 100644
--- a/nautilus-actions/nact/nact-iactions-list.c
+++ b/nautilus-actions/nact/nact-iactions-list.c
@@ -667,6 +667,8 @@ nact_iactions_list_fill( NactIActionsList *instance, GList *items )
treeview = nact_iactions_list_priv_get_actions_list_treeview( instance );
model = NACT_TREE_MODEL( gtk_tree_view_get_model( treeview ));
+ nact_iactions_list_bis_clear_selection( instance, treeview );
+
ialid = nact_iactions_list_priv_get_instance_data( instance );
only_actions = have_only_actions( instance, ialid );
diff --git a/nautilus-actions/nact/nact-iactions-list.h b/nautilus-actions/nact/nact-iactions-list.h
index 1dc4138..513ad73 100644
--- a/nautilus-actions/nact/nact-iactions-list.h
+++ b/nautilus-actions/nact/nact-iactions-list.h
@@ -137,6 +137,7 @@ void nact_iactions_list_on_treeview_selection_changed( GtkTreeSelection *se
GList *nact_iactions_list_remove_rec( GList *list, NAObject *object );
void nact_iactions_list_set_management_mode( NactIActionsList *instance, gint mode );
+void nact_iactions_list_bis_clear_selection( NactIActionsList *instance, GtkTreeView *treeview );
void nact_iactions_list_bis_collapse_to_parent( NactIActionsList *instance );
void nact_iactions_list_bis_delete( NactIActionsList *instance, GList *items );
void nact_iactions_list_bis_expand_to_first_child( NactIActionsList *instance );
diff --git a/nautilus-actions/nact/nact-main-menubar.c b/nautilus-actions/nact/nact-main-menubar.c
index 6ba21f9..ac9bc28 100644
--- a/nautilus-actions/nact/nact-main-menubar.c
+++ b/nautilus-actions/nact/nact-main-menubar.c
@@ -646,8 +646,7 @@ on_update_sensitivities( NactMainWindow *window, gpointer user_data )
mis = ( MenubarIndicatorsStruct * ) g_object_get_data( G_OBJECT( window ), MENUBAR_PROP_INDICATORS );
is_clipboard_empty = ( mis->clipboard_menus + mis->clipboard_actions + mis->clipboard_profiles == 0 );
- count_selected = mis->selected_menus + mis->selected_actions + mis->selected_profiles;
- g_return_if_fail( selected_items == NULL || count_selected == g_list_length( selected_items ));
+ count_selected = selected_items ? g_list_length( selected_items ) : 0;
/* new menu / new action
* new item will be inserted just before beginning of selection
diff --git a/nautilus-actions/nact/nact-main-window.c b/nautilus-actions/nact/nact-main-window.c
index 57a0a71..41178c1 100644
--- a/nautilus-actions/nact/nact-main-window.c
+++ b/nautilus-actions/nact/nact-main-window.c
@@ -1376,9 +1376,11 @@ ipivot_consumer_on_actions_changed( NAIPivotConsumer *instance, gpointer user_da
static void
reload( NactMainWindow *window )
{
+ static const gchar *thisfn = "nact_main_window_reload";
NactApplication *application;
NAPivot *pivot;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
if( !window->private->dispose_has_run ){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]