[nautilus-actions] na_export_format_get_pixbuf(): new function



commit 08f145497b278c3d12b930e20612e709b34999b9
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Dec 22 00:36:18 2011 +0100

    na_export_format_get_pixbuf(): new function

 ChangeLog                   |   11 +++++++++++
 src/core/na-export-format.c |   30 ++++++++++++++++++++++++++++--
 src/core/na-export-format.h |    3 ++-
 src/core/na-exporter.c      |    4 ++--
 4 files changed, 43 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 64e5ef0..67937e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-12-22 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-export-format.c:
+	* src/core/na-export-format.h
+	(na_export_format_get_exporter): Renamed as na_export_format_get_provider().
+	(na_export_format_get_pixbuf): New function.
+
+	* src/core/na-exporter.c
+	(exporter_free_formats): Fix the test.
+	(find_exporter_for_format): Updated accordingly.
+
 2011-12-21 Pierre Wieser <pwieser trychlos org>
 
 	NAIExporter interface upgrade.
diff --git a/src/core/na-export-format.c b/src/core/na-export-format.c
index 2b78be5..51bc0c0 100644
--- a/src/core/na-export-format.c
+++ b/src/core/na-export-format.c
@@ -302,7 +302,7 @@ na_export_format_get_description( const NAExportFormat *format )
 }
 
 /*
- * na_export_format_get_exporter:
+ * na_export_format_get_provider:
  * @format: this #NAExportFormat object.
  *
  * Returns: a pointer to the #NAIExporter which provides this format.
@@ -311,7 +311,7 @@ na_export_format_get_description( const NAExportFormat *format )
  * by the caller.
  */
 NAIExporter *
-na_export_format_get_exporter( const NAExportFormat *format )
+na_export_format_get_provider( const NAExportFormat *format )
 {
 	NAIExporter *exporter;
 
@@ -326,3 +326,29 @@ na_export_format_get_exporter( const NAExportFormat *format )
 
 	return( exporter );
 }
+
+/*
+ * na_export_format_get_pixbuf:
+ * @format: this #NAExportFormat object.
+ *
+ * Returns: a new reference to the #GdkPixbuf image associated with this format,
+ * or %NULL.
+ */
+GdkPixbuf *
+na_export_format_get_pixbuf( const NAExportFormat *format )
+{
+	GdkPixbuf *pixbuf;
+
+	g_return_val_if_fail( NA_IS_EXPORT_FORMAT( format ), NULL );
+
+	pixbuf = NULL;
+
+	if( !format->private->dispose_has_run ){
+
+		if( format->private->pixbuf ){
+			pixbuf = g_object_ref( format->private->pixbuf );
+		}
+	}
+
+	return( pixbuf );
+}
diff --git a/src/core/na-export-format.h b/src/core/na-export-format.h
index 3cf6cac..17ba878 100644
--- a/src/core/na-export-format.h
+++ b/src/core/na-export-format.h
@@ -75,7 +75,8 @@ GQuark          na_export_format_get_quark      ( const NAExportFormat *format )
 gchar          *na_export_format_get_id         ( const NAExportFormat *format );
 gchar          *na_export_format_get_label      ( const NAExportFormat *format );
 gchar          *na_export_format_get_description( const NAExportFormat *format );
-NAIExporter    *na_export_format_get_exporter   ( const NAExportFormat *format );
+NAIExporter    *na_export_format_get_provider   ( const NAExportFormat *format );
+GdkPixbuf      *na_export_format_get_pixbuf     ( const NAExportFormat *format );
 
 G_END_DECLS
 
diff --git a/src/core/na-exporter.c b/src/core/na-exporter.c
index 7767de7..cb2f6e4 100644
--- a/src/core/na-exporter.c
+++ b/src/core/na-exporter.c
@@ -309,7 +309,7 @@ exporter_free_formats( const NAIExporter *exporter, GList *str_list )
 		g_list_free( str_list );
 
 	} else {
-		g_return_if_fail( !NA_IEXPORTER_GET_INTERFACE( exporter )->free_formats );
+		g_return_if_fail( NA_IEXPORTER_GET_INTERFACE( exporter )->free_formats );
 		NA_IEXPORTER_GET_INTERFACE( exporter )->free_formats( exporter, str_list );
 	}
 }
@@ -340,7 +340,7 @@ find_exporter_for_format( const NAPivot *pivot, GQuark format )
 	for( ifmt = formats ; ifmt && !exporter ; ifmt = ifmt->next ){
 
 		if( na_export_format_get_quark( NA_EXPORT_FORMAT( ifmt->data )) == format ){
-			exporter = na_export_format_get_exporter( NA_EXPORT_FORMAT( ifmt->data ));
+			exporter = na_export_format_get_provider( NA_EXPORT_FORMAT( ifmt->data ));
 		}
 	}
 



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