[gimp] app: add stubs for gimp_prop_language_entry_new()
- From: Sven Neumann <neo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: add stubs for gimp_prop_language_entry_new()
- Date: Tue, 4 Aug 2009 20:45:58 +0000 (UTC)
commit e2dbd56c5a4491be16fb32dbaa8aeadfe14b347c
Author: Sven Neumann <sven gimp org>
Date: Tue Aug 4 21:26:32 2009 +0200
app: add stubs for gimp_prop_language_entry_new()
app/widgets/gimppropwidgets.c | 125 +++++++++++++++++++++++++++++++++++++----
app/widgets/gimppropwidgets.h | 5 ++
2 files changed, 118 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 88c0aeb..4645cd9 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -39,6 +39,7 @@
#include "gimpcolorpanel.h"
#include "gimpdnd.h"
+#include "gimplanguageentry.h"
#include "gimpscalebutton.h"
#include "gimpview.h"
#include "gimppropwidgets.h"
@@ -615,18 +616,19 @@ static void gimp_prop_number_pair_entry_number_pair_user_override_notify
*
* Return value: A #GimpNumberPairEntry widget.
*/
-GtkWidget * gimp_prop_number_pair_entry_new (GObject *config,
- const gchar *left_number_property,
- const gchar *right_number_property,
- const gchar *default_left_number_property,
- const gchar *default_right_number_property,
- const gchar *user_override_property,
- gboolean connect_numbers_changed,
- gboolean connect_ratio_changed,
- const gchar *separators,
- gboolean allow_simplification,
- gdouble min_valid_value,
- gdouble max_valid_value)
+GtkWidget *
+gimp_prop_number_pair_entry_new (GObject *config,
+ const gchar *left_number_property,
+ const gchar *right_number_property,
+ const gchar *default_left_number_property,
+ const gchar *default_right_number_property,
+ const gchar *user_override_property,
+ gboolean connect_numbers_changed,
+ gboolean connect_ratio_changed,
+ const gchar *separators,
+ gboolean allow_simplification,
+ gdouble min_valid_value,
+ gdouble max_valid_value)
{
GimpPropNumberPairEntryData *data;
GtkWidget *number_pair_entry;
@@ -819,6 +821,105 @@ gimp_prop_number_pair_entry_number_pair_user_override_notify (GtkWidget
}
+/********************/
+/* language entry */
+/********************/
+
+static void gimp_prop_language_entry_callback (GtkWidget *entry,
+ GObject *config);
+static void gimp_prop_language_entry_notify (GObject *config,
+ GParamSpec *param_spec,
+ GtkWidget *entry);
+
+GtkWidget *
+gimp_prop_language_entry_new (GObject *config,
+ const gchar *property_name)
+{
+ GParamSpec *param_spec;
+ GtkWidget *entry;
+ gchar *value;
+
+ param_spec = check_param_spec_w (config, property_name,
+ G_TYPE_PARAM_STRING, G_STRFUNC);
+ if (! param_spec)
+ return NULL;
+
+ entry = gimp_language_entry_new ();
+
+ g_object_get (config,
+ property_name, &value,
+ NULL);
+
+ // FIXME
+ gtk_entry_set_text (GTK_ENTRY (entry), value);
+ g_free (value);
+
+ set_param_spec (G_OBJECT (entry), entry, param_spec);
+
+ g_signal_connect (entry, "changed",
+ G_CALLBACK (gimp_prop_language_entry_callback),
+ config);
+
+ connect_notify (config, property_name,
+ G_CALLBACK (gimp_prop_language_entry_notify),
+ entry);
+
+ return entry;
+}
+
+static void
+gimp_prop_language_entry_callback (GtkWidget *entry,
+ GObject *config)
+{
+ GParamSpec *param_spec;
+ const gchar *text;
+
+ param_spec = get_param_spec (G_OBJECT (entry));
+ if (! param_spec)
+ return;
+
+ // FIXME
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+
+ g_signal_handlers_block_by_func (config,
+ gimp_prop_language_entry_notify,
+ entry);
+
+ g_object_set (config,
+ param_spec->name, text,
+ NULL);
+
+ g_signal_handlers_unblock_by_func (config,
+ gimp_prop_language_entry_notify,
+ entry);
+}
+
+static void
+gimp_prop_language_entry_notify (GObject *config,
+ GParamSpec *param_spec,
+ GtkWidget *entry)
+{
+ gchar *value;
+
+ g_object_get (config,
+ param_spec->name, &value,
+ NULL);
+
+ g_signal_handlers_block_by_func (entry,
+ gimp_prop_language_entry_callback,
+ config);
+
+ // FIXME
+ gtk_entry_set_text (GTK_ENTRY (entry), value ? value : "");
+
+ g_signal_handlers_unblock_by_func (entry,
+ gimp_prop_language_entry_callback,
+ config);
+
+ g_free (value);
+}
+
+
/***********/
/* table */
/***********/
diff --git a/app/widgets/gimppropwidgets.h b/app/widgets/gimppropwidgets.h
index 4326a07..2b95c74 100644
--- a/app/widgets/gimppropwidgets.h
+++ b/app/widgets/gimppropwidgets.h
@@ -78,6 +78,11 @@ GtkWidget * gimp_prop_number_pair_entry_new
gdouble min_valid_value,
gdouble max_valid_value);
+/* GParamString */
+
+GtkWidget * gimp_prop_language_entry_new (GObject *config,
+ const gchar *property_name);
+
/* A view on all of an object's properties */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]