[nautilus-actions] na_iprefs_get/set_tabs_pos(): new functions



commit 767a1f3af6cd35064171774ac73f3895b374a9df
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 1 22:27:16 2012 +0100

    na_iprefs_get/set_tabs_pos(): new functions

 ChangeLog            |    4 ++++
 src/core/na-iprefs.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 src/core/na-iprefs.h |    3 +++
 3 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fcf7589..9656eca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-02-01 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-iprefs.c:
+	* src/core/na-iprefs.h (na_iprefs_get_tabs_pos, na_iprefs_set_tabs_pos):
+	New functions.
+
 	* src/core/na-settings.c:
 	* src/core/na-settings.h: Define new "main-tabs-pos" user preference.
 
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index bd88327..c4d2d55 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -60,6 +60,14 @@ static EnumMap st_order_mode[] = {
 	{ 0 }
 };
 
+static EnumMap st_tabs_pos[] = {
+	{ GTK_POS_LEFT,   "Left" },
+	{ GTK_POS_RIGHT,  "Right" },
+	{ GTK_POS_TOP,    "Top" },
+	{ GTK_POS_BOTTOM, "Bottom" },
+	{ 0 }
+};
+
 static const gchar *enum_map_string_from_id( const EnumMap *map, guint id );
 static guint        enum_map_id_from_string( const EnumMap *map, const gchar *str );
 
@@ -120,6 +128,41 @@ na_iprefs_set_order_mode( guint mode )
 }
 
 /*
+ * na_iprefs_get_tabs_pos:
+ * @mandatory: if not %NULL, a pointer to a boolean which will receive the
+ *  mandatory property.
+ *
+ * Returns: the tabs position of the main window.
+ */
+guint
+na_iprefs_get_tabs_pos( gboolean *mandatory )
+{
+	gchar *tabs_pos_str;
+	guint tabs_pos;
+
+	tabs_pos_str = na_settings_get_string( NA_IPREFS_MAIN_TABS_POS, NULL, mandatory );
+	tabs_pos = enum_map_id_from_string( st_tabs_pos, tabs_pos_str );
+	g_free( tabs_pos_str );
+
+	return( tabs_pos );
+}
+
+/*
+ * na_iprefs_set_tabs_pos:
+ * @position: the new value to be written.
+ *
+ * Writes the current status of 'tabs position' to the preference system.
+ */
+void
+na_iprefs_set_tabs_pos( guint position )
+{
+	const gchar *tabs_pos_str;
+
+	tabs_pos_str = enum_map_string_from_id( st_tabs_pos, position );
+	na_settings_set_string( NA_IPREFS_MAIN_TABS_POS, tabs_pos_str );
+}
+
+/*
  * na_iprefs_write_level_zero:
  * @items: the #GList of items whose first level is to be written.
  * @messages: a pointer to a #GSList in which we will add happening
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index ac12265..50d56f2 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -56,6 +56,9 @@ guint    na_iprefs_get_order_mode         ( gboolean *mandatory );
 guint    na_iprefs_get_order_mode_by_label( const gchar *label );
 void     na_iprefs_set_order_mode         ( guint mode );
 
+guint    na_iprefs_get_tabs_pos           ( gboolean *mandatory );
+void     na_iprefs_set_tabs_pos           ( guint pos );
+
 gboolean na_iprefs_write_level_zero       ( const GList *items, GSList **messages );
 
 G_END_DECLS



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