[nautilus-actions: 12/19] Cleanup the code
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions: 12/19] Cleanup the code
- Date: Tue, 9 Jun 2009 16:55:58 -0400 (EDT)
commit d0b1df3624cf3c735b4f530226a4fa742904c6f2
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Jun 9 21:53:29 2009 +0200
Cleanup the code
---
ChangeLog | 4 ++-
src/common/nact-pivot.c | 89 +++++++++++++++++++----------------------------
src/common/nact-pivot.h | 1 -
3 files changed, 39 insertions(+), 55 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17e736b..bab3c80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,7 +20,9 @@
(nact_object_empty_property): Remove function and cleanup the code.
* src/common/nact-pivot.c:
- * src/common/nact-pivot.h:
+ * src/common/nact-pivot.h
+ (nact_pivot_get_action): Remove function and cleanup the code.
+
* src/plugin/nautilus-actions.c:
The plugin now uses the new object hierarchy to handle menu items.
Fix #580378 (context menu doesn't update) reported by James Campos.
diff --git a/src/common/nact-pivot.c b/src/common/nact-pivot.c
index e0eba5e..cc31edf 100644
--- a/src/common/nact-pivot.c
+++ b/src/common/nact-pivot.c
@@ -100,16 +100,9 @@ static void instance_finalize( GObject *object );
static void free_actions( GSList *list );
static void action_changed_handler( NactPivot *pivot, gpointer user_data );
-static NactAction *get_action( GSList *list, const gchar *uuid );
static gboolean on_action_changed_timeout( gpointer user_data );
static gulong time_val_diff( const GTimeVal *recent, const GTimeVal *old );
-NactPivot *
-nact_pivot_new( const GObject *target )
-{
- return( g_object_new( NACT_PIVOT_TYPE, PROP_NOTIFIED_STR, target, NULL ));
-}
-
GType
nact_pivot_get_type( void )
{
@@ -195,6 +188,19 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->actions = nact_iio_provider_load_actions( G_OBJECT( self ));
}
+static GSList *
+register_interface_providers( const NactPivot *pivot )
+{
+ static const gchar *thisfn = "nact_pivot_register_interface_providers";
+ g_debug( "%s", thisfn );
+
+ GSList *list = NULL;
+
+ list = g_slist_prepend( list, nact_gconf_new( G_OBJECT( pivot )));
+
+ return( list );
+}
+
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
@@ -229,19 +235,6 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
}
}
-static GSList *
-register_interface_providers( const NactPivot *pivot )
-{
- static const gchar *thisfn = "nact_pivot_register_interface_providers";
- g_debug( "%s", thisfn );
-
- GSList *list = NULL;
-
- list = g_slist_prepend( list, nact_gconf_new( G_OBJECT( pivot )));
-
- return( list );
-}
-
static void
instance_dispose( GObject *object )
{
@@ -287,14 +280,20 @@ instance_finalize( GObject *object )
}
}
-static void
-free_actions( GSList *list )
+/**
+ * Allocates a new NactPivot object.
+ *
+ * @target: the GObject which will handled Nautilus notification, and
+ * should be notified when an actions is added, modified or removed in
+ * one of the underlying storage subsystems.
+ *
+ * The target object will receive a "notify_nautilus_of_action_changed"
+ * message, without any parameter.
+ */
+NactPivot *
+nact_pivot_new( const GObject *target )
{
- GSList *ia;
- for( ia = list ; ia ; ia = ia->next ){
- g_object_unref( NACT_ACTION( ia->data ));
- }
- g_slist_free( list );
+ return( g_object_new( NACT_PIVOT_TYPE, PROP_NOTIFIED_STR, target, NULL ));
}
/**
@@ -336,6 +335,16 @@ nact_pivot_get_actions( const NactPivot *pivot )
return( pivot->private->actions );
}
+static void
+free_actions( GSList *list )
+{
+ GSList *ia;
+ for( ia = list ; ia ; ia = ia->next ){
+ g_object_unref( NACT_ACTION( ia->data ));
+ }
+ g_slist_free( list );
+}
+
/*
* this handler is trigerred by IIOProviders when an action is changed
* in the underlying storage subsystems
@@ -363,32 +372,6 @@ action_changed_handler( NactPivot *self, gpointer user_data )
}
}
-static NactAction *
-get_action( GSList *list, const gchar *uuid )
-{
- NactAction *found = NULL;
- GSList *ia;
- for( ia = list ; ia && !found ; ia = ia->next ){
- NactAction *action = ( NactAction * ) ia->data;
- gchar *id = nact_action_get_uuid( action );
- if( !g_strcmp0( id, uuid )){
- found = action;
- }
- g_free( id );
- }
- return( found );
-}
-
-/**
- * Returns the searched NactAction, or NULL.
- */
-GObject *
-nact_pivot_get_action( NactPivot *pivot, const gchar *uuid )
-{
- g_assert( NACT_IS_PIVOT( pivot ));
- return( G_OBJECT( get_action( pivot->private->actions, uuid )));
-}
-
/*
* this timer is set when we receive the first event of a serie
* we continue to loop until last event is at least one half of a
diff --git a/src/common/nact-pivot.h b/src/common/nact-pivot.h
index 35f0c0d..fd56f4f 100644
--- a/src/common/nact-pivot.h
+++ b/src/common/nact-pivot.h
@@ -74,7 +74,6 @@ NactPivot *nact_pivot_new( const GObject *notified );
GSList *nact_pivot_get_providers( const NactPivot *pivot, GType type );
GSList *nact_pivot_get_actions( const NactPivot *pivot );
-GObject *nact_pivot_get_action( NactPivot *pivot, const gchar *uuid );
/* data passed from the storage subsystem when an action is changed
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]