[nautilus-actions] Refactoring: update Nact classes



commit 624e20d9d9a527b5b52911acbf210e05201c806a
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 17 12:05:44 2010 +0100

    Refactoring: update Nact classes

 ChangeLog                        |   17 +++++++++++++++
 src/api/na-iduplicable.h         |    3 +-
 src/api/na-object-api.h          |    4 +++
 src/api/na-object-item.h         |    1 +
 src/core/na-exporter.c           |   31 +++++++++++++++++++++++++--
 src/core/na-exporter.h           |    3 +-
 src/core/na-iduplicable.c        |   42 +++++++++++++++++++------------------
 src/core/na-object-item.c        |   41 +++++++++++++++++++++++++++++++++++++
 src/nact/Makefile.am             |    2 -
 src/nact/nact-assistant-export.c |    8 ++++--
 src/nact/nact-clipboard.c        |   42 +++++++++++++++++--------------------
 src/nact/nact-clipboard.h        |    2 +-
 src/nact/nact-confirm-logout.c   |    4 +-
 src/nact/nact-export-ask.c       |    7 ++++++
 src/nact/nact-export-format.c    |   27 +++++++++++------------
 src/nact/nact-export-format.h    |    8 +++---
 src/nact/nact-iprefs.h           |    7 ++---
 src/nact/nact-main-menubar.h     |    4 +-
 18 files changed, 173 insertions(+), 80 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 021f31e..84b0b79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-02-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/api/na-iduplicable.h:
+	* src/api/na-object-api.h:
+	* src/api/na-object-item.h:
+	* src/core/na-exporter.c:
+	* src/core/na-exporter.h:
+	* src/core/na-iduplicable.c:
+	* src/core/na-object-item.c:
+	* src/nact/Makefile.am:
+	* src/nact/nact-assistant-export.c:
+	* src/nact/nact-clipboard.c:
+	* src/nact/nact-clipboard.h:
+	* src/nact/nact-confirm-logout.c:
+	* src/nact/nact-export-ask.c:
+	* src/nact/nact-export-format.c:
+	* src/nact/nact-export-format.h:
+	* src/nact/nact-iprefs.h:
+	* src/nact/nact-main-menubar.h:
 	* src/nact/nact-assistant-export.c:
 	* src/nact/nact-assistant-export.h:
 	* src/nact/nact-assistant-export.ui:
diff --git a/src/api/na-iduplicable.h b/src/api/na-iduplicable.h
index b74ee19..f935e4c 100644
--- a/src/api/na-iduplicable.h
+++ b/src/api/na-iduplicable.h
@@ -138,13 +138,14 @@ void           na_iduplicable_check_status( const NAIDuplicable *object );
 NAIDuplicable *na_iduplicable_get_origin  ( const NAIDuplicable *object );
 gboolean       na_iduplicable_is_valid    ( const NAIDuplicable *object );
 
+void           na_iduplicable_set_origin  ( NAIDuplicable *object, const NAIDuplicable *origin );
+
 #if 0
 void           na_iduplicable_init        ( NAIDuplicable *object );
 
 void           na_iduplicable_reset_status( NAIDuplicable *object );
 
 gboolean       na_iduplicable_is_modified( const NAIDuplicable *object );
-void           na_iduplicable_set_origin( NAIDuplicable *object, const NAIDuplicable *origin );
 
 void           na_iduplicable_register_consumer( GObject *consumer );
 #endif
diff --git a/src/api/na-object-api.h b/src/api/na-object-api.h
index e75563f..36ab01e 100644
--- a/src/api/na-object-api.h
+++ b/src/api/na-object-api.h
@@ -54,9 +54,12 @@ G_BEGIN_DECLS
  */
 #define na_object_duplicate( obj )						na_iduplicable_duplicate( NA_IDUPLICABLE( obj ))
 #define na_object_check_status( obj )					na_object_object_check_status( NA_OBJECT( obj ))
+
 #define na_object_get_origin( obj )						na_iduplicable_get_origin( NA_IDUPLICABLE( obj ))
 #define na_object_is_valid( obj )						na_iduplicable_is_valid( NA_IDUPLICABLE( obj ))
 
+#define na_object_set_origin( obj, origin )				na_iduplicable_set_origin( NA_IDUPLICABLE( obj ), ( NAIDuplicable * )( origin ))
+
 /* NAObject
  */
 #define na_object_dump( obj )							na_object_object_dump( NA_OBJECT( obj ))
@@ -101,6 +104,7 @@ G_BEGIN_DECLS
 #define na_object_get_item( obj, id )					na_object_item_get_item( NA_OBJECT_ITEM( obj ),( const gchar * )( id ))
 #define na_object_append_item( obj, child )				na_object_item_append_item( NA_OBJECT_ITEM( obj ), NA_OBJECT_ID( child ))
 #define na_object_build_items_slist( obj )				na_object_item_build_items_slist( NA_OBJECT_ITEM( obj ))
+#define na_object_count_items( list, cm, ca, cp, brec )	na_object_item_count_items( list, ( cm ), ( ca ), ( cp ), ( brec ))
 #define na_object_unref_items( tree )					na_object_item_unref_items( tree )
 
 /* NAObjectAction
diff --git a/src/api/na-object-item.h b/src/api/na-object-item.h
index 0814565..3df9579 100644
--- a/src/api/na-object-item.h
+++ b/src/api/na-object-item.h
@@ -85,6 +85,7 @@ void        na_object_item_append_item( NAObjectItem *object, const NAObjectId *
 
 GSList     *na_object_item_build_items_slist( const NAObjectItem *item );
 
+void        na_object_item_count_items( GList *items, gint *menus, gint *actions, gint *profiles, gboolean recurse );
 void        na_object_item_unref_items( GList *items );
 
 G_END_DECLS
diff --git a/src/core/na-exporter.c b/src/core/na-exporter.c
index 1a78bc0..c05269a 100644
--- a/src/core/na-exporter.c
+++ b/src/core/na-exporter.c
@@ -108,10 +108,10 @@ na_exporter_free_formats( GList *formats )
 }
 
 /**
- * na_exporter_export:
+ * na_exporter_to_file:
  * @item: a #NAObjectItem-derived object.
  * @uri: the target URI.
- * @format: the target format.
+ * @format: the #GQuark target format.
  * @messages: a pointer to a #GSList list of strings; the provider
  *  may append messages to this list, but shouldn't reinitialize it.
  *
@@ -121,7 +121,7 @@ na_exporter_free_formats( GList *formats )
  * should be g_free() by the caller, or %NULL if an error has been detected.
  */
 gchar *
-na_exporter_export( const NAObjectItem *item, const gchar *uri, guint format, GSList **messages )
+na_exporter_to_file( const NAObjectItem *item, const gchar *uri, GQuark format, GSList **messages )
 {
 	gchar *fname;
 
@@ -132,3 +132,28 @@ na_exporter_export( const NAObjectItem *item, const gchar *uri, guint format, GS
 
 	return( fname );
 }
+
+/**
+ * na_exporter_to_buffer:
+ * @item: a #NAObjectItem-derived object.
+ * @format: the #GQuark target format.
+ * @messages: a pointer to a #GSList list of strings; the provider
+ *  may append messages to this list, but shouldn't reinitialize it.
+ *
+ * Exports the specified @item in the required @format.
+ *
+ * Returns: the output buffer, as a newly allocated string which should
+ * be g_free() by the caller, or %NULL if an error has been detected.
+ */
+gchar *
+na_exporter_to_buffer( const NAObjectItem *item, GQuark format, GSList **messages )
+{
+	gchar *buffer;
+
+	buffer = NULL;
+
+	if( iexporter_initialized && !iexporter_finalized ){
+	}
+
+	return( buffer );
+}
diff --git a/src/core/na-exporter.h b/src/core/na-exporter.h
index 588874a..5801aeb 100644
--- a/src/core/na-exporter.h
+++ b/src/core/na-exporter.h
@@ -46,7 +46,8 @@ G_BEGIN_DECLS
 GList *na_exporter_get_formats ( const NAPivot *pivot );
 void   na_exporter_free_formats( GList *formats );
 
-gchar *na_exporter_export( const NAObjectItem *item, const gchar *uri, guint format, GSList **messages );
+gchar *na_exporter_to_file  ( const NAObjectItem *item, const gchar *uri, GQuark format, GSList **messages );
+gchar *na_exporter_to_buffer( const NAObjectItem *item, GQuark format, GSList **messages );
 
 G_END_DECLS
 
diff --git a/src/core/na-iduplicable.c b/src/core/na-iduplicable.c
index c80d95a..621d53e 100644
--- a/src/core/na-iduplicable.c
+++ b/src/core/na-iduplicable.c
@@ -429,6 +429,28 @@ na_iduplicable_is_valid( const NAIDuplicable *object )
 	return( is_valid );
 }
 
+/**
+ * na_iduplicable_set_origin:
+ * @object: the #NAIDuplicable object whose origin is to be set.
+ * @origin: the new original #NAIDuplicable.
+ *
+ * Sets the new origin of a duplicated #NAIDuplicable.
+ */
+void
+na_iduplicable_set_origin( NAIDuplicable *object, const NAIDuplicable *origin )
+{
+	DuplicableStr *str;
+
+	g_return_if_fail( NA_IS_IDUPLICABLE( object ));
+	g_return_if_fail( NA_IS_IDUPLICABLE( origin ) || !origin );
+
+	if( st_initialized && !st_finalized ){
+
+		str = get_duplicable_str( object );
+		str->origin = ( NAIDuplicable * ) origin;
+	}
+}
+
 static void
 v_copy( NAIDuplicable *target, const NAIDuplicable *source )
 {
@@ -500,26 +522,6 @@ na_iduplicable_is_modified( const NAIDuplicable *object )
 }
 
 /**
- * na_iduplicable_set_origin:
- * @object: the #NAIDuplicable object whose origin is to be set.
- * @origin: the new original #NAIDuplicable.
- *
- * Sets the new origin of a duplicated #NAIDuplicable.
- */
-void
-na_iduplicable_set_origin( NAIDuplicable *object, const NAIDuplicable *origin )
-{
-	/*static const gchar *thisfn = "na_iduplicable_is_valid";
-	g_debug( "%s: object=%p", thisfn, object );*/
-
-	g_return_if_fail( st_initialized && !st_finalized );
-	g_return_if_fail( NA_IS_IDUPLICABLE( object ));
-	g_return_if_fail( NA_IS_IDUPLICABLE( origin ) || !origin );
-
-	set_origin( object, origin );
-}
-
-/**
  * na_iduplicable_register_consumer:
  * @consumer: the target instance.
  *
diff --git a/src/core/na-object-item.c b/src/core/na-object-item.c
index 0c45749..ad1b72b 100644
--- a/src/core/na-object-item.c
+++ b/src/core/na-object-item.c
@@ -424,6 +424,47 @@ na_object_item_build_items_slist( const NAObjectItem *item )
 }
 
 /**
+ * na_object_item_count_items:
+ * @items: a list if #NAObject-derived to be counted.
+ * @menus: will be set to the count of menus.
+ * @actions: will be set to the count of actions.
+ * @profiles: will be set to the count of profiles.
+ * @recurse: whether to recursively count all items, or only those in
+ *  level zero of the list.
+ *
+ * Count the numbers of items if the provided list.
+ *
+ * As this function is recursive, the counters should be initialized by
+ * the caller before calling it.
+ */
+void
+na_object_item_count_items( GList *items, gint *menus, gint *actions, gint *profiles, gboolean recurse )
+{
+	GList *it;
+
+	/*g_debug( "na_object_item_count_items: items=%p (count=%d), menus=%d, actions=%d, profiles=%d",
+			( void * ) items, items ? g_list_length( items ) : 0, *menus, *actions, *profiles );*/
+
+	for( it = items ; it ; it = it->next ){
+
+		if( recurse ){
+			if( NA_IS_OBJECT_ITEM( it->data )){
+				GList *subitems = na_object_get_items( it->data );
+				na_object_count_items( subitems, menus, actions, profiles, recurse );
+			}
+		}
+
+		if( NA_IS_OBJECT_MENU( it->data )){
+			*menus += 1;
+		} else if( NA_IS_OBJECT_ACTION( it->data )){
+			*actions += 1;
+		} else if( NA_IS_OBJECT_PROFILE( it->data )){
+			*profiles += 1;
+		}
+	}
+}
+
+/**
  * na_object_item_unref_items:
  * @list: a list of #NAObject-derived items.
  *
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index e61eecc..f85e94f 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -128,8 +128,6 @@ nautilus_actions_config_tool_SOURCES = \
 	nact-tree-model-priv.h								\
 	nact-window.c										\
 	nact-window.h										\
-	nact-xml-reader.c									\
-	nact-xml-reader.h									\
 	$(BUILT_SOURCES)									\
 	$(NULL)
 
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index b118853..b1d68e1 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -638,6 +638,7 @@ static void
 assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page )
 {
 	static const gchar *thisfn = "nact_assistant_export_prepare_confirm";
+	GtkWidget *container;
 	gchar *text, *tmp, *text2;
 	gchar *label1, *label2, *label3;
 	GList *actions, *ia;
@@ -674,8 +675,9 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
 	label1 = NULL;
 	label2 = NULL;
 	format = get_export_format( window );
-	label1 = nact_export_format_get_label( format );
-	label2 = nact_export_format_get_description( format );
+	container = base_window_get_widget( BASE_WINDOW( window ), "AssistantExportFormatVBox" );
+	label1 = nact_export_format_get_label( container, format );
+	label2 = nact_export_format_get_description( container, format );
 	nact_iprefs_set_export_format( BASE_WINDOW( window ), IPREFS_EXPORT_FORMAT, format );
 
 	label3 = na_core_utils_str_add_prefix( "\t", label2 );
@@ -728,7 +730,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
 		}
 
 		if( str->format != IPREFS_EXPORT_NO_EXPORT ){
-			str->fname = na_exporter_export( str->item, window->private->uri, str->format, &str->msg );
+			str->fname = na_exporter_to_file( str->item, window->private->uri, str->format, &str->msg );
 		}
 	}
 
diff --git a/src/nact/nact-clipboard.c b/src/nact/nact-clipboard.c
index 0f4cc51..77b689f 100644
--- a/src/nact/nact-clipboard.c
+++ b/src/nact/nact-clipboard.c
@@ -37,14 +37,11 @@
 
 #include <api/na-object-api.h>
 
-#include <runtime/na-iprefs.h>
-#include <runtime/na-pivot.h>
-#include <runtime/na-utils.h>
-#include <runtime/na-xml-names.h>
-#include <runtime/na-xml-writer.h>
+#include <core/na-exporter.h>
 
 #include "nact-application.h"
-#include "nact-assistant-export-ask.h"
+#include "nact-iprefs.h"
+#include "nact-export-ask.h"
 #include "nact-tree-model.h"
 #include "nact-clipboard.h"
 
@@ -529,6 +526,10 @@ export_objects( NactClipboard *clipboard, GList *objects, const gchar *dest_fold
 	return( g_string_free( data, FALSE ));
 }
 
+/*
+ * export to a buffer if dest_folder is null
+ * else export to a new file in the target directory
+ */
 static gchar *
 export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest_folder, GList **exported )
 {
@@ -537,14 +538,12 @@ export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest
 	gint index;
 	GString *data;
 	gchar *buffer;
-	NactApplication *application;
-	NAPivot *pivot;
-	gint format;
+	GQuark format;
 	gchar *fname;
 	GSList *msg;
 
 	if( NA_IS_OBJECT_MENU( object )){
-		subitems = na_object_get_items_list( object );
+		subitems = na_object_get_items( object );
 		data = g_string_new( "" );
 
 		for( isub = subitems ; isub ; isub = isub->next ){
@@ -567,25 +566,22 @@ export_row_object( NactClipboard *clipboard, NAObject *object, const gchar *dest
 
 	index = g_list_index( *exported, ( gconstpointer ) action );
 	if( index == -1 ){
-		*exported = g_list_prepend( *exported, ( gpointer ) action );
 
-		application = NACT_APPLICATION( base_window_get_application( clipboard->private->window ));
-		pivot = nact_application_get_pivot( application );
-		format = na_iprefs_get_export_format( NA_IPREFS( pivot ), IPREFS_EXPORT_FORMAT );
+		*exported = g_list_prepend( *exported, ( gpointer ) action );
+		format = nact_iprefs_get_export_format( clipboard->private->window, IPREFS_EXPORT_FORMAT );
 
 		if( format == IPREFS_EXPORT_FORMAT_ASK ){
-			format = nact_assistant_export_ask_user( clipboard->private->window, action );
+			format = nact_export_ask_user( clipboard->private->window, NA_OBJECT_ITEM( action ));
 		}
 
 		if( format != IPREFS_EXPORT_NO_EXPORT ){
-			buffer = na_xml_writer_get_xml_buffer( action, format );
 
-			if( buffer && dest_folder ){
-				fname = na_xml_writer_get_output_fname( action, dest_folder, format );
-				na_xml_writer_output_xml( buffer, fname, &msg );
+			if( dest_folder ){
+				fname = na_exporter_to_file( NA_OBJECT_ITEM( action), dest_folder, format, &msg );
 				g_free( fname );
-				g_free( buffer );
-				buffer = NULL;
+
+			} else {
+				buffer = na_exporter_to_buffer( NA_OBJECT_ITEM( action ), format, NULL );
 			}
 		}
 	}
@@ -638,7 +634,7 @@ nact_clipboard_primary_set( NactClipboard *clipboard, GList *items, gint mode )
 			clear_primary_clipboard( clipboard );
 		}
 
-		na_object_item_count_items( items,
+		na_object_count_items( items,
 				( gint * ) &user_data->nb_menus,
 				( gint * ) &user_data->nb_actions,
 				( gint * ) &user_data->nb_profiles,
@@ -696,7 +692,7 @@ nact_clipboard_primary_get( NactClipboard *clipboard, gboolean *relabel )
 
 			if( user_data ){
 				for( it = user_data->items ; it ; it = it->next ){
-					obj = na_object_duplicate( it->data );
+					obj = NA_OBJECT( na_object_duplicate( it->data ));
 					na_object_set_origin( obj, NULL );
 					items = g_list_prepend( items, obj );
 				}
diff --git a/src/nact/nact-clipboard.h b/src/nact/nact-clipboard.h
index c0a7554..0a536b7 100644
--- a/src/nact/nact-clipboard.h
+++ b/src/nact/nact-clipboard.h
@@ -54,7 +54,7 @@ G_BEGIN_DECLS
 #define NACT_IS_CLIPBOARD_CLASS( klass )	( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_CLIPBOARD_TYPE ))
 #define NACT_CLIPBOARD_GET_CLASS( object )	( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_CLIPBOARD_TYPE, NactClipboardClass ))
 
-typedef struct NactClipboardPrivate NactClipboardPrivate;
+typedef struct NactClipboardPrivate      NactClipboardPrivate;
 
 typedef struct {
 	GObject               parent;
diff --git a/src/nact/nact-confirm-logout.c b/src/nact/nact-confirm-logout.c
index 919725b..9cd16c3 100644
--- a/src/nact/nact-confirm-logout.c
+++ b/src/nact/nact-confirm-logout.c
@@ -64,7 +64,7 @@ static void     instance_finalize( GObject *dialog );
 
 static NactConfirmLogout *confirm_logout_new( BaseWindow *parent );
 
-static gchar   *base_get_dialog_name( BaseWindow *window );
+static gchar   *base_get_dialog_name( const BaseWindow *window );
 static void     on_base_initial_load_dialog( NactConfirmLogout *editor, gpointer user_data );
 static void     on_base_runtime_init_dialog( NactConfirmLogout *editor, gpointer user_data );
 static void     on_base_all_widgets_showed( NactConfirmLogout *editor, gpointer user_data );
@@ -246,7 +246,7 @@ nact_confirm_logout_run( NactMainWindow *parent )
 }
 
 static gchar *
-base_get_dialog_name( BaseWindow *window )
+base_get_dialog_name( const BaseWindow *window )
 {
 	return( g_strdup( "ConfirmLogoutDialog" ));
 }
diff --git a/src/nact/nact-export-ask.c b/src/nact/nact-export-ask.c
index a978b36..684d58d 100644
--- a/src/nact/nact-export-ask.c
+++ b/src/nact/nact-export-ask.c
@@ -38,7 +38,9 @@
 
 #include <core/na-exporter.h>
 
+#include "nact-application.h"
 #include "nact-iprefs.h"
+#include "nact-export-format.h"
 #include "nact-export-ask.h"
 
 /* private class data
@@ -310,6 +312,9 @@ on_base_runtime_init_dialog( NactExportAsk *editor, gpointer user_data )
 {
 	static const gchar *thisfn = "nact_export_ask_on_runtime_init_dialog";
 	GtkWidget *container;
+	gchar *item_label, *label;
+	GtkWidget *widget;
+	GtkWidget *button;
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
 	g_return_if_fail( NACT_IS_EXPORT_ASK( editor ));
@@ -371,6 +376,8 @@ get_format( NactExportAsk *editor )
 {
 	GtkWidget *container;
 	GQuark export_format;
+	GtkWidget *button;
+	gboolean keep;
 
 	container = base_window_get_widget( BASE_WINDOW( editor ), "ExportFormatAskVBox" );
 	export_format = nact_export_format_get_select( container );
diff --git a/src/nact/nact-export-format.c b/src/nact/nact-export-format.c
index 47efc8b..e05b2b8 100755
--- a/src/nact/nact-export-format.c
+++ b/src/nact/nact-export-format.c
@@ -37,6 +37,8 @@
 #include <core/na-exporter.h>
 #include <core/na-export-format.h>
 
+#include "nact-export-format.h"
+
 #define EXPORT_FORMAT_PROP_QUARK_ID		"nact-export-format-prop-quark-id"
 #define EXPORT_FORMAT_PROP_BUTTON		"nact-export-format-prop-button"
 #define EXPORT_FORMAT_PROP_LABEL		"nact-export-format-prop-label"
@@ -51,7 +53,7 @@ typedef struct {
 	GQuark   format;
 	gboolean found;
 	gchar   *label;
-	guint    prop;
+	gchar   *prop;
 }
 	NactExportFormatStr;
 
@@ -72,7 +74,6 @@ void
 nact_export_format_display( const NAPivot *pivot, GtkWidget *vbox, guint mode )
 {
 	GList *formats, *ifmt;
-	NAExporterStr *str;
 
 	formats = na_exporter_get_formats( pivot );
 
@@ -96,7 +97,7 @@ static void
 draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
 {
 	static const gchar *thisfn = "nact_export_format_draw_in_vbox";
-	static GtkRadioButton first_button = NULL;
+	static GtkRadioButton *first_button = NULL;
 	GtkVBox *vbox;
 	gchar *description;
 	GtkHBox *hbox1, *hbox2;
@@ -107,7 +108,7 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
 	GtkLabel *desc_label;
 
 	vbox = GTK_VBOX( gtk_vbox_new( FALSE, 0 ));
-	gtk_box_pack_start( container, GTK_WIDGET( vbox ), FALSE, TRUE, 0 );
+	gtk_box_pack_start( GTK_BOX( container ), GTK_WIDGET( vbox ), FALSE, TRUE, 0 );
 	description = na_export_format_get_description( format );
 	g_object_set( G_OBJECT( vbox ), "tooltip-text", description, NULL );
 
@@ -178,7 +179,7 @@ draw_in_vbox( const NAExportFormat *format, GtkWidget *container, guint mode )
  * Select the default value.
  */
 void
-nact_export_format_select( GtkWidget *container, GQuark format )
+nact_export_format_select( const GtkWidget *container, GQuark format )
 {
 	NactExportFormatStr *str;
 
@@ -186,7 +187,7 @@ nact_export_format_select( GtkWidget *container, GQuark format )
 	str->format = format;
 	str->found = FALSE;
 
-	gtk_container_foreach( GTK_CONTAINER( container ), G_CALLBACK( select_default_iter ), str );
+	gtk_container_foreach( GTK_CONTAINER( container ), ( GtkCallback ) select_default_iter, str );
 
 	g_free( str );
 }
@@ -214,7 +215,7 @@ select_default_iter( GtkWidget *widget, NactExportFormatStr *str )
  * Returns: the currently selected value, as a #GQuark.
  */
 GQuark
-nact_export_format_get_select( GtkWidget *container )
+nact_export_format_get_select( const GtkWidget *container )
 {
 	GQuark format;
 	NactExportFormatStr *str;
@@ -225,7 +226,7 @@ nact_export_format_get_select( GtkWidget *container )
 	str->format = 0;
 	str->found = FALSE;
 
-	gtk_container_foreach( GTK_CONTAINER( container ), G_CALLBACK( get_selected_iter ), str );
+	gtk_container_foreach( GTK_CONTAINER( container ), ( GtkCallback ) get_selected_iter, str );
 
 	if( str->found ){
 		format = str->format;
@@ -239,7 +240,6 @@ nact_export_format_get_select( GtkWidget *container )
 static void
 get_selected_iter( GtkWidget *widget, NactExportFormatStr *str )
 {
-	GQuark format;
 	GtkRadioButton *button;
 
 	if( !str->found ){
@@ -259,7 +259,7 @@ get_selected_iter( GtkWidget *widget, NactExportFormatStr *str )
  * should be g_free() by the caller.
  */
 gchar *
-nact_export_format_get_label( GQuark format )
+nact_export_format_get_label( const GtkWidget *container, GQuark format )
 {
 	gchar *label;
 	NactExportFormatStr *str;
@@ -271,7 +271,7 @@ nact_export_format_get_label( GQuark format )
 	str->found = FALSE;
 	str->prop = EXPORT_FORMAT_PROP_LABEL;
 
-	gtk_container_foreach( GTK_CONTAINER( container ), G_CALLBACK( get_label_iter ), str );
+	gtk_container_foreach( GTK_CONTAINER( container ), ( GtkCallback ) get_label_iter, str );
 
 	if( str->found ){
 		label = str->label;
@@ -290,7 +290,7 @@ nact_export_format_get_label( GQuark format )
  * should be g_free() by the caller.
  */
 gchar *
-nact_export_format_get_description( GQuark format )
+nact_export_format_get_description( const GtkWidget *container, GQuark format )
 {
 	gchar *label;
 	NactExportFormatStr *str;
@@ -302,7 +302,7 @@ nact_export_format_get_description( GQuark format )
 	str->found = FALSE;
 	str->prop = EXPORT_FORMAT_PROP_DESCRIPTION;
 
-	gtk_container_foreach( GTK_CONTAINER( container ), G_CALLBACK( get_label_iter ), str );
+	gtk_container_foreach( GTK_CONTAINER( container ), ( GtkCallback ) get_label_iter, str );
 
 	if( str->found ){
 		label = str->label;
@@ -318,7 +318,6 @@ get_label_iter( GtkWidget *widget, NactExportFormatStr *str )
 {
 	GQuark format;
 	GtkLabel *gtk_label;
-	gchar *label;
 
 	if( !str->found ){
 		format = ( GQuark ) GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( widget ), EXPORT_FORMAT_PROP_QUARK_ID ));
diff --git a/src/nact/nact-export-format.h b/src/nact/nact-export-format.h
index 6459af1..3f2dc8c 100644
--- a/src/nact/nact-export-format.h
+++ b/src/nact/nact-export-format.h
@@ -60,11 +60,11 @@ enum {
 };
 
 void   nact_export_format_display( const NAPivot *pivot, GtkWidget *container, guint mode );
-void   nact_export_format_select( GtkWidget *container, GQuark format );
-GQuark nact_export_format_get_select( GtkWidget *container );
+void   nact_export_format_select( const GtkWidget *container, GQuark format );
+GQuark nact_export_format_get_select( const GtkWidget *container );
 
-gchar *nact_export_format_get_label( GQuark format );
-gchar *nact_export_format_get_description( GQuark format );
+gchar *nact_export_format_get_label      ( const GtkWidget *container, GQuark format );
+gchar *nact_export_format_get_description( const GtkWidget *container, GQuark format );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 6bf476f..13af329 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -86,11 +86,10 @@ GType nact_iprefs_get_type( void );
 GQuark nact_iprefs_get_export_format( const BaseWindow *window, const gchar *pref );
 void   nact_iprefs_set_export_format( const BaseWindow *window, const gchar *pref, GQuark format );
 
-gint  nact_iprefs_get_import_mode  ( const BaseWindow *window, const gchar *pref );
+gint  nact_iprefs_get_import_mode   ( const BaseWindow *window, const gchar *pref );
+void  nact_iprefs_set_import_mode   ( const BaseWindow *window, const gchar *pref, gint mode );
 
-void  nact_iprefs_set_import_mode  ( const BaseWindow *window, const gchar *pref, gint mode );
-
-void  nact_iprefs_write_string( const BaseWindow *window, const gchar *name, const gchar *value );
+void  nact_iprefs_write_string      ( const BaseWindow *window, const gchar *name, const gchar *value );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-main-menubar.h b/src/nact/nact-main-menubar.h
index 9e9e460..cdc601c 100644
--- a/src/nact/nact-main-menubar.h
+++ b/src/nact/nact-main-menubar.h
@@ -37,9 +37,9 @@
  * @include: nact/nact-main-menubar.h
  */
 
-#include <private/na-object-class.h>
+#include <api/na-object.h>
 
-#include <runtime/na-pivot.h>
+#include <core/na-pivot.h>
 
 #include "nact-main-window.h"
 



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