[nautilus-actions] Do not keep a reference on our internal menus



commit 43d9cf3e587c3e6c0f156d9616ffd19330d5f8b9
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jul 2 09:11:19 2010 +0200

    Do not keep a reference on our internal menus

 ChangeLog                          |    8 ++++++++
 src/core/na-tokens.c               |    3 +++
 src/core/na-tokens.h               |    2 +-
 src/plugin-menu/nautilus-actions.c |   12 +-----------
 4 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f1e3a7f..70029ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-07-02 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-tokens.c (na_tokens_new_from_selection):
+	Add a trace.
+
+	* src/core/na-tokens.h: Fix minor typo.
+
+	* src/plugin-menu/nautilus-actions.c:
+	There should not be any need to keep a reference to our menu.
+
 	* data/nautilus-actions-prefs.schemas.in:
 	* src/core/na-iprefs.h:
 	* src/core/na-importer-ask.c:
diff --git a/src/core/na-tokens.c b/src/core/na-tokens.c
index 87ecad6..719c13f 100644
--- a/src/core/na-tokens.c
+++ b/src/core/na-tokens.c
@@ -235,6 +235,7 @@ instance_finalize( GObject *object )
 NATokens *
 na_tokens_new_from_selection( GList *selection )
 {
+	static const gchar *thisfn = "na_tokens_new_from_selection";
 	NATokens *tokens;
 	GList *it;
 	gchar *uri, *filename, *basedir, *basename, *bname_woext, *ext;
@@ -242,6 +243,8 @@ na_tokens_new_from_selection( GList *selection )
 	gboolean first;
 	NAGnomeVFSURI *vfs;
 
+	g_debug( "%s: selection=%p (count=%d)", thisfn, ( void * ) selection, g_list_length( selection ));
+
 	first = TRUE;
 	tokens = g_object_new( NA_TOKENS_TYPE, NULL );
 
diff --git a/src/core/na-tokens.h b/src/core/na-tokens.h
index c54bf99..52eb198 100644
--- a/src/core/na-tokens.h
+++ b/src/core/na-tokens.h
@@ -43,7 +43,7 @@
  * when an item was selected in the Nautilus context menu (i.e. at
  * execution time).
  * Starting with v2.32 (v3.0 ?), this same parsing may occur for each
- * displayed label (as new specs accept tokenss in labels) - we so
+ * displayed label (as new specs accept tokens in labels) - we so
  * factorize this parsing one time for each new selection in the Nautilus
  * plugin, attaching the result to each item in the context menu.
  *
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 14163a2..02477e8 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -99,7 +99,6 @@ static NautilusMenuItem *create_menu_item( NAObjectItem *item );
 static void              attach_submenu_to_item( NautilusMenuItem *item, GList *subitems );
 static void              weak_notify_profile( NAObjectProfile *profile, NautilusMenuItem *item );
 static void              destroy_notify_file_list( GList *list);
-static void              weak_notify_menu( NAObjectMenu *menu, NautilusMenuItem *item );
 
 static void              execute_action( NautilusMenuItem *item, NAObjectProfile *profile );
 
@@ -635,7 +634,7 @@ expand_tokens_item( NAObjectItem *item, NATokens *tokens )
  * This mainly means that the objects have to be re-parsed for each new
  * selection (e.g. because a label may change if it depends of the current
  * selection). Thus, all the hierarchy must be recursively re-parsed, and
- * re-checked for validity !
+ * should be re-checked for validity !
  */
 static GList *
 build_nautilus_menus( NautilusActions *plugin, GList *tree, guint target, GList *files, NATokens *tokens )
@@ -797,7 +796,6 @@ create_item_from_menu( NAObjectMenu *menu, GList *subitems )
 	NautilusMenuItem *item;
 
 	item = create_menu_item( NA_OBJECT_ITEM( menu ));
-	g_object_weak_ref( G_OBJECT( item ), ( GWeakNotify ) weak_notify_menu, menu );
 
 	attach_submenu_to_item( item, subitems );
 	nautilus_menu_item_list_free( subitems );
@@ -806,14 +804,6 @@ create_item_from_menu( NAObjectMenu *menu, GList *subitems )
 	return( item );
 }
 
-static void
-weak_notify_menu( NAObjectMenu *menu, NautilusMenuItem *item )
-{
-	g_debug( "nautilus_actions_weak_notify_menu: menu=%p (ref_count=%d)",
-			( void * ) menu, G_OBJECT( menu )->ref_count );
-	/*g_object_unref( menu );*/
-}
-
 static NautilusMenuItem *
 create_menu_item( NAObjectItem *item )
 {



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