[gnome-control-center] Add cc_setting_editor_new_string



commit 20ff4db1ba29e487178a7354266bd0e45c4b1d6e
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Mon Oct 11 10:50:06 2010 +0200

    Add cc_setting_editor_new_string

 libgnome-control-center/cc-setting-editor.c |   31 +++++++++++++++++++++++++++
 libgnome-control-center/cc-setting-editor.h |    2 +
 2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-control-center/cc-setting-editor.c b/libgnome-control-center/cc-setting-editor.c
index daa1bd1..24f81fa 100644
--- a/libgnome-control-center/cc-setting-editor.c
+++ b/libgnome-control-center/cc-setting-editor.c
@@ -239,6 +239,7 @@ cc_setting_editor_new_application (const gchar *mime_type)
 
 /**
  * cc_setting_editor_new_boolean:
+ * @label: Text to display next to the check button.
  * @settings_prefix: The settings prefix for the key.
  * @key: The settings key to associate with.
  *
@@ -271,6 +272,36 @@ cc_setting_editor_new_boolean (const gchar *label,
 }
 
 /**
+ * cc_setting_editor_new_string:
+ * @settings_prefix: The settings prefix for the key.
+ * @key: The settings key to associate with.
+ *
+ * Create a new #CCSettingEditor object to configure a string setting.
+ *
+ * Return value: A newly created #CCSettingEditor object.
+ */
+GtkWidget *
+cc_setting_editor_new_string (const gchar *settings_prefix,
+                              const gchar *key)
+{
+  GtkWidget *entry;
+  CcSettingEditor *seditor;
+
+  entry = gtk_entry_new ();
+  gtk_widget_show (entry);
+
+  /* Create the CcSettingEditor widget */
+  seditor = cc_setting_editor_new (SETTING_TYPE_GSETTINGS,
+                                   settings_prefix,
+                                   key,
+                                   entry);
+
+  g_settings_bind (seditor->priv->settings, key, entry, "text", G_SETTINGS_BIND_DEFAULT);
+
+  return (GtkWidget *) seditor;
+}
+
+/**
  * cc_setting_editor_get_key:
  * @seditor: a #CCSettingEditor object.
  *
diff --git a/libgnome-control-center/cc-setting-editor.h b/libgnome-control-center/cc-setting-editor.h
index 743dd11..5a609a6 100644
--- a/libgnome-control-center/cc-setting-editor.h
+++ b/libgnome-control-center/cc-setting-editor.h
@@ -69,6 +69,8 @@ GtkWidget   *cc_setting_editor_new_application (const gchar *mime_type);
 GtkWidget   *cc_setting_editor_new_boolean (const gchar *label,
                                             const gchar *settings_prefix,
                                             const gchar *key);
+GtkWidget   *cc_setting_editor_new_string (const gchar *settings_prefix,
+                                           const gchar *key);
 
 const gchar *cc_setting_editor_get_key (CcSettingEditor *editor);
 GtkWidget   *cc_setting_editor_get_ui_control (CcSettingEditor *seditor);



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