[nautilus-actions: 24/30] Define functions with actual type for arguments
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions: 24/30] Define functions with actual type for arguments
- Date: Sat, 21 Nov 2009 18:03:17 +0000 (UTC)
commit 903570e4fd822532ca7c8d1c426d625ea7540be1
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Nov 21 00:45:15 2009 +0100
Define functions with actual type for arguments
na_pivot_add_item, na_pivot_get_item now take/return NAObjectItem.
ChangeLog | 10 ++++++
TODO | 4 --
nautilus-actions/nact/nact-main-menubar.c | 2 +-
nautilus-actions/nact/nact-main-window.c | 2 +-
nautilus-actions/runtime/na-pivot.c | 45 +++++++++++++++--------------
nautilus-actions/runtime/na-pivot.h | 44 ++++++++++++++--------------
6 files changed, 57 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 78041fe..3296a42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-11-20 Pierre Wieser <pwieser trychlos org>
+ Define functions with actual type for arguments.
+
+ * nautilus-actions/runtime/na-pivot.c:
+ * nautilus-actions/runtime/na-pivot.h
+ (na_pivot_add_item, na_pivot_get_item): Take/return a NAObjectItem.
+
+ * nautilus-actions/nact/nact-main-menubar.c (save_item):
+ * nautilus-actions/nact/nact-main-window.c (nact_main_window_get_item):
+ Updated accordingly.
+
Get ride of "unsolicitated invocation of g_object_dispose() on
GTypeModule" error message.
diff --git a/TODO b/TODO
index 9c16e4a..05e5e0e 100644
--- a/TODO
+++ b/TODO
@@ -79,8 +79,6 @@
- export: add a overwrite page: what to do if file already exists ?
-- na_object_id_get_topmost_parent: should it return a NAObjectItem ?
-
- nautilus-actions-new:
give same defaults that when creating an action in NACT
@@ -89,5 +87,3 @@
- in 64bits arch, pkglibdir=/lib ??
- NACT: unable to really delete an action imported with schemas
-
-- na_pivot_get_item: should return NAObjectItem
diff --git a/nautilus-actions/nact/nact-main-menubar.c b/nautilus-actions/nact/nact-main-menubar.c
index 517867e..72d672e 100644
--- a/nautilus-actions/nact/nact-main-menubar.c
+++ b/nautilus-actions/nact/nact-main-menubar.c
@@ -872,7 +872,7 @@ save_item( NactMainWindow *window, NAPivot *pivot, NAObjectItem *item )
na_object_insert_at( parent, dup_pivot, pos );
}
} else {
- na_pivot_add_item( pivot, NA_OBJECT( dup_pivot ));
+ na_pivot_add_item( pivot, dup_pivot );
}
}
}
diff --git a/nautilus-actions/nact/nact-main-window.c b/nautilus-actions/nact/nact-main-window.c
index 58c9132..44cdfa3 100644
--- a/nautilus-actions/nact/nact-main-window.c
+++ b/nautilus-actions/nact/nact-main-window.c
@@ -732,7 +732,7 @@ nact_main_window_get_item( const NactMainWindow *window, const gchar *uuid )
if( 0 ){
application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
pivot = nact_application_get_pivot( application );
- exists = NA_OBJECT_ITEM( na_pivot_get_item( pivot, uuid ));
+ exists = na_pivot_get_item( pivot, uuid );
}
if( !exists ){
diff --git a/nautilus-actions/runtime/na-pivot.c b/nautilus-actions/runtime/na-pivot.c
index 58e5462..75fb38b 100644
--- a/nautilus-actions/runtime/na-pivot.c
+++ b/nautilus-actions/runtime/na-pivot.c
@@ -93,29 +93,29 @@ static gint st_signals[ LAST_SIGNAL ] = { 0 };
static gint st_timeout_msec = 100;
static gint st_timeout_usec = 100000;
-static GType register_type( void );
-static void class_init( NAPivotClass *klass );
-static void iprefs_iface_init( NAIPrefsInterface *iface );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *object );
-static void instance_finalize( GObject *object );
+static GType register_type( void );
+static void class_init( NAPivotClass *klass );
+static void iprefs_iface_init( NAIPrefsInterface *iface );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
-static NAObject *get_item_from_tree( const NAPivot *pivot, GList *tree, uuid_t uuid );
+static NAObjectItem *get_item_from_tree( const NAPivot *pivot, GList *tree, uuid_t uuid );
/* NAIIOProvider management */
-static gboolean on_item_changed_timeout( NAPivot *pivot );
-static gulong time_val_diff( const GTimeVal *recent, const GTimeVal *old );
+static gboolean on_item_changed_timeout( NAPivot *pivot );
+static gulong time_val_diff( const GTimeVal *recent, const GTimeVal *old );
/* NAIPivotConsumer management */
-static void free_consumers( GList *list );
+static void free_consumers( GList *list );
/* NAGConf runtime preferences management */
-static void monitor_runtime_preferences( NAPivot *pivot );
+static void monitor_runtime_preferences( NAPivot *pivot );
-static void on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot );
-static void display_order_changed( NAPivot *pivot );
-static void create_root_menu_changed( NAPivot *pivot );
-static void display_about_changed( NAPivot *pivot );
+static void on_preferences_change( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAPivot *pivot );
+static void display_order_changed( NAPivot *pivot );
+static void create_root_menu_changed( NAPivot *pivot );
+static void display_about_changed( NAPivot *pivot );
GType
na_pivot_get_type( void )
@@ -547,7 +547,7 @@ na_pivot_reload_items( NAPivot *pivot )
* be g_object_unref() by the caller.
*/
void
-na_pivot_add_item( NAPivot *pivot, const NAObject *item )
+na_pivot_add_item( NAPivot *pivot, const NAObjectItem *item )
{
g_return_if_fail( NA_IS_PIVOT( pivot ));
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
@@ -564,15 +564,16 @@ na_pivot_add_item( NAPivot *pivot, const NAObject *item )
*
* Returns the specified action.
*
- * Returns: the required #NAAction object, or NULL if not found.
+ * Returns: the required #NAObjectItem-derived object, or NULL if not
+ * found.
* The returned pointer is owned by #NAPivot, and should not be
* g_free() nor g_object_unref() by the caller.
*/
-NAObject *
+NAObjectItem *
na_pivot_get_item( const NAPivot *pivot, const gchar *uuid )
{
uuid_t uuid_bin;
- NAObject *object = NULL;
+ NAObjectItem *object = NULL;
g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
@@ -822,12 +823,12 @@ na_pivot_write_level_zero( const NAPivot *pivot, GList *items )
}
}
-static NAObject *
+static NAObjectItem *
get_item_from_tree( const NAPivot *pivot, GList *tree, uuid_t uuid )
{
uuid_t i_uuid_bin;
GList *subitems, *ia;
- NAObject *found = NULL;
+ NAObjectItem *found = NULL;
for( ia = tree ; ia && !found ; ia = ia->next ){
@@ -836,7 +837,7 @@ get_item_from_tree( const NAPivot *pivot, GList *tree, uuid_t uuid )
g_free( i_uuid );
if( !uuid_compare( uuid, i_uuid_bin )){
- found = NA_OBJECT( ia->data );
+ found = NA_OBJECT_ITEM( ia->data );
}
if( !found && NA_IS_OBJECT_ITEM( ia->data )){
diff --git a/nautilus-actions/runtime/na-pivot.h b/nautilus-actions/runtime/na-pivot.h
index c78e7b7..109acfc 100644
--- a/nautilus-actions/runtime/na-pivot.h
+++ b/nautilus-actions/runtime/na-pivot.h
@@ -107,38 +107,38 @@ typedef struct {
}
NAPivotClass;
-GType na_pivot_get_type( void );
+GType na_pivot_get_type( void );
-NAPivot *na_pivot_new( const NAIPivotConsumer *notified );
-void na_pivot_check_status( const NAPivot *pivot );
-void na_pivot_dump( const NAPivot *pivot );
+NAPivot *na_pivot_new( const NAIPivotConsumer *notified );
+void na_pivot_check_status( const NAPivot *pivot );
+void na_pivot_dump( const NAPivot *pivot );
-void na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot *pivot );
+void na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot *pivot );
-GList *na_pivot_get_providers( const NAPivot *pivot, GType type );
-GObject *na_pivot_get_provider( const NAPivot *pivot, GType type );
-void na_pivot_release_provider( const GObject *provider );
-void na_pivot_free_providers( GList *providers );
+GList *na_pivot_get_providers( const NAPivot *pivot, GType type );
+GObject *na_pivot_get_provider( const NAPivot *pivot, GType type );
+void na_pivot_release_provider( const GObject *provider );
+void na_pivot_free_providers( GList *providers );
-GList *na_pivot_get_items( const NAPivot *pivot );
-void na_pivot_reload_items( NAPivot *pivot );
+GList *na_pivot_get_items( const NAPivot *pivot );
+void na_pivot_reload_items( NAPivot *pivot );
-void na_pivot_add_item( NAPivot *pivot, const NAObject *item );
-NAObject *na_pivot_get_item( const NAPivot *pivot, const gchar *uuid );
-void na_pivot_remove_item( NAPivot *pivot, NAObject *item );
+void na_pivot_add_item( NAPivot *pivot, const NAObjectItem *item );
+NAObjectItem *na_pivot_get_item( const NAPivot *pivot, const gchar *uuid );
+void na_pivot_remove_item( NAPivot *pivot, NAObject *item );
-guint na_pivot_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages );
-guint na_pivot_write_item( const NAPivot *pivot, NAObjectItem *item, GSList **messages );
+guint na_pivot_delete_item( const NAPivot *pivot, const NAObjectItem *item, GSList **messages );
+guint na_pivot_write_item( const NAPivot *pivot, NAObjectItem *item, GSList **messages );
-void na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer );
+void na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer *consumer );
-gboolean na_pivot_get_automatic_reload( const NAPivot *pivot );
-void na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload );
+gboolean na_pivot_get_automatic_reload( const NAPivot *pivot );
+void na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload );
-gint na_pivot_sort_alpha_asc( const NAObjectId *a, const NAObjectId *b );
-gint na_pivot_sort_alpha_desc( const NAObjectId *a, const NAObjectId *b );
+gint na_pivot_sort_alpha_asc( const NAObjectId *a, const NAObjectId *b );
+gint na_pivot_sort_alpha_desc( const NAObjectId *a, const NAObjectId *b );
-void na_pivot_write_level_zero( const NAPivot *pivot, GList *items );
+void na_pivot_write_level_zero( const NAPivot *pivot, GList *items );
/* notification message from NAIIOProvider to NAPivot
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]