summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--src/glade-editor.c128
-rw-r--r--src/glade-property.c3
-rw-r--r--widgets/gtk+.xml.in11
4 files changed, 44 insertions, 112 deletions
diff --git a/ChangeLog b/ChangeLog
index bda7bb32..4e7807f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-01-11 Richard Hult <richard@imendio.com>
+
+ * src/glade-editor.c: (glade_editor_create_input_text),
+ (glade_editor_append_item_real),
+ (glade_editor_property_load_text),
+ (glade_editor_property_load): Merge the translatable and
+ non-translatable input widgets.
+
+ * src/glade-property.c: (glade_property_write),
+ (glade_property_i18n_set_comment): Remove debug spew.
+
+ * widgets/gtk+.xml: Mark the appropriate properties
+ non-translatable.
+
2005-01-11 Mikael Hallendal <micke@imendio.com>
* src/glade-catalog.c: (catalog_load), (catalog_load_group):
diff --git a/src/glade-editor.c b/src/glade-editor.c
index 90044e66..79dc1acc 100644
--- a/src/glade-editor.c
+++ b/src/glade-editor.c
@@ -891,50 +891,6 @@ glade_editor_create_input_text (GladeEditorProperty *property)
gint lines = 1;
g_return_val_if_fail (property != NULL, NULL);
- g_return_val_if_fail (!property->class->translatable, NULL);
-
- class = property->class;
-
- glade_parameter_get_integer (class->parameters, GLADE_TAG_VISIBLE_LINES, &lines);
-
- if (lines < 2) {
- GtkWidget *entry;
-
- entry = gtk_entry_new ();
-
- g_signal_connect (G_OBJECT (entry), "activate",
- G_CALLBACK (glade_editor_property_changed_text),
- property);
-
- g_signal_connect (G_OBJECT (entry), "focus-out-event",
- G_CALLBACK (glade_editor_entry_focus_out),
- property);
-
- return entry;
- } else {
- GtkTextView *view;
-
- view = GTK_TEXT_VIEW (gtk_text_view_new ());
- gtk_text_view_set_editable (view, TRUE);
-
- g_signal_connect (G_OBJECT (view), "focus-out-event",
- G_CALLBACK (glade_editor_text_view_focus_out),
- property);
-
- return GTK_WIDGET (view);
- }
-
- return NULL;
-}
-
-static GtkWidget *
-glade_editor_create_input_translatable_text (GladeEditorProperty *property)
-{
- GladePropertyClass *class;
- gint lines = 1;
-
- g_return_val_if_fail (property != NULL, NULL);
- g_return_val_if_fail (property->class->translatable, NULL);
class = property->class;
@@ -949,14 +905,7 @@ glade_editor_create_input_translatable_text (GladeEditorProperty *property)
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("...");
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (glade_editor_property_show_i18n_dialog),
- property);
-
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (glade_editor_property_changed_text),
property);
@@ -965,6 +914,15 @@ glade_editor_create_input_translatable_text (GladeEditorProperty *property)
G_CALLBACK (glade_editor_entry_focus_out),
property);
+ if (property->class->translatable) {
+ button = gtk_button_new_with_label ("...");
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (glade_editor_property_show_i18n_dialog),
+ property);
+ }
+
return hbox;
} else {
GtkWidget *hbox;
@@ -975,20 +933,21 @@ glade_editor_create_input_translatable_text (GladeEditorProperty *property)
view = GTK_TEXT_VIEW (gtk_text_view_new ());
gtk_text_view_set_editable (view, TRUE);
-
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (view), TRUE, TRUE, 0);
- button = gtk_button_new_with_label ("...");
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (glade_editor_property_show_i18n_dialog),
- property);
-
g_signal_connect (G_OBJECT (view), "focus-out-event",
G_CALLBACK (glade_editor_text_view_focus_out),
property);
+ if (property->class->translatable) {
+ button = gtk_button_new_with_label ("...");
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (glade_editor_property_show_i18n_dialog),
+ property);
+ }
+
return hbox;
}
@@ -1141,9 +1100,6 @@ glade_editor_append_item_real (GladeEditorTable *table,
G_IS_PARAM_SPEC_FLOAT(property->class->pspec) ||
G_IS_PARAM_SPEC_DOUBLE(property->class->pspec))
input = glade_editor_create_input_numeric (property);
- else if (G_IS_PARAM_SPEC_STRING(property->class->pspec) &&
- property->class->translatable)
- input = glade_editor_create_input_translatable_text (property);
else if (G_IS_PARAM_SPEC_STRING(property->class->pspec))
input = glade_editor_create_input_text (property);
else if (G_IS_PARAM_SPEC_STRING(property->class->pspec))
@@ -1647,46 +1603,6 @@ glade_editor_property_load_boolean (GladeEditorProperty *property)
static void
glade_editor_property_load_text (GladeEditorProperty *property)
{
- g_return_if_fail (property != NULL);
- g_return_if_fail (property->property != NULL);
- g_return_if_fail (property->property->value != NULL);
- g_return_if_fail (property->input != NULL);
- g_return_if_fail (!property->class->translatable);
-
- if (GTK_IS_EDITABLE (property->input)) {
- GtkEditable *editable = GTK_EDITABLE (property->input);
- gint pos, insert_pos = 0;
- const gchar *text;
- text = g_value_get_string (property->property->value);
- pos = gtk_editable_get_position (editable);
- gtk_editable_delete_text (editable, 0, -1);
- if (text)
- gtk_editable_insert_text (editable,
- text,
- g_utf8_strlen (text, -1),
- &insert_pos);
- gtk_editable_set_position (editable, pos);
- } else if (GTK_IS_TEXT_VIEW (property->input)) {
- GtkTextBuffer *buffer;
- const gchar *text;
-
- if ((text = g_value_get_string (property->property->value)) != NULL)
- {
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (property->input));
- gtk_text_buffer_set_text (buffer,
- text,
- g_utf8_strlen (text, -1));
- }
- } else {
- g_warning ("Invalid Text Widget type.");
- }
-
- g_object_set_data (G_OBJECT (property->input), "user_data", property);
-}
-
-static void
-glade_editor_property_load_translatable_text (GladeEditorProperty *property)
-{
GtkBoxChild *child;
GtkWidget *widget;
@@ -1694,9 +1610,8 @@ glade_editor_property_load_translatable_text (GladeEditorProperty *property)
g_return_if_fail (property->property != NULL);
g_return_if_fail (property->property->value != NULL);
g_return_if_fail (property->input != NULL);
- g_return_if_fail (property->class->translatable);
-
- /* The entry should be the first child. */
+
+ /* The entry/textview is the first child. */
child = GTK_BOX (property->input)->children->data;
widget = child->widget;
@@ -1775,9 +1690,6 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
glade_editor_property_load_enum (property);
else if (G_IS_PARAM_SPEC_FLAGS(class->pspec))
glade_editor_property_load_flags (property);
- else if (G_IS_PARAM_SPEC_STRING(class->pspec) &&
- class->translatable)
- glade_editor_property_load_translatable_text (property);
else if (G_IS_PARAM_SPEC_STRING(class->pspec))
glade_editor_property_load_text (property);
else if (G_IS_PARAM_SPEC_BOOLEAN(class->pspec))
diff --git a/src/glade-property.c b/src/glade-property.c
index bacab63e..354fc6d7 100644
--- a/src/glade-property.c
+++ b/src/glade-property.c
@@ -349,7 +349,6 @@ glade_property_write (GArray *props, GladeProperty *property, GladeInterface *in
if (property->class->translatable)
{
/* FIXME: implement writing the i18n metadata. */
- g_print ("FIXME: write i18n metadata\n");
}
info.value = alloc_string(interface, tmp);
@@ -369,8 +368,6 @@ glade_property_i18n_set_comment (GladeProperty *property,
g_free (property->i18n_comment);
property->i18n_comment = g_strdup (str);
-
- g_print ("set comment: %s\n", str);
}
const gchar *
diff --git a/widgets/gtk+.xml.in b/widgets/gtk+.xml.in
index ddbd4fab..3cd2143d 100644
--- a/widgets/gtk+.xml.in
+++ b/widgets/gtk+.xml.in
@@ -22,6 +22,7 @@
<set-function>ignore</set-function>
<get-function>ignore</get-function>
</property>
+ <property id="name" translatable="False"/>
</properties>
</glade-widget-class>
@@ -92,6 +93,8 @@
<property id="allow-shrink" disabled="TRUE" />
<property id="allow-grow" disabled="TRUE" />
<property id="resize-mode" disabled="TRUE" />
+ <property id="role" translatable="False"/>
+ <property id="icon-name" translatable="False"/>
</properties>
</glade-widget-class>
@@ -208,7 +211,13 @@
<glade-widget-class name="GtkProgressBar" generic-name="progressbar" title="Progress Bar"/>
- <glade-widget-class name="GtkImage" generic-name="image" title="Image"/>
+ <glade-widget-class name="GtkImage" generic-name="image" title="Image">
+ <properties>
+ <property id="icon-name" translatable="False"/>
+ <property id="file" translatable="False"/>
+ <property id="stock" translatable="False"/>
+ </properties>
+ </glade-widget-class>
<glade-widget-class name="GtkDialog" generic-name="dialog" title="Dialog Box">
<post-create-function>glade_gtk_dialog_post_create</post-create-function>