[libgda] Use GtkWidget::*expand properties instead of custom methods



commit d008508a969a33a8422e199673b033149973bad7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu Aug 16 22:18:47 2012 +0200

    Use GtkWidget::*expand properties instead of custom methods

 libgda-ui/data-entries/gdaui-entry-bin.c           |    8 -------
 libgda-ui/data-entries/gdaui-entry-boolean.c       |    8 -------
 libgda-ui/data-entries/gdaui-entry-combo.c         |   15 --------------
 libgda-ui/data-entries/gdaui-entry-common-time.c   |    8 -------
 libgda-ui/data-entries/gdaui-entry-none.c          |    9 --------
 libgda-ui/data-entries/gdaui-entry-number.c        |    8 -------
 libgda-ui/data-entries/gdaui-entry-string.c        |   19 +----------------
 libgda-ui/data-entries/gdaui-entry-wrapper.c       |   21 +------------------
 libgda-ui/data-entries/gdaui-entry-wrapper.h       |    2 +-
 libgda-ui/data-entries/plugins/gdaui-entry-cidr.c  |    9 --------
 .../data-entries/plugins/gdaui-entry-filesel.c     |    8 -------
 .../data-entries/plugins/gdaui-entry-format.c      |    8 -------
 .../data-entries/plugins/gdaui-entry-password.c    |    8 -------
 libgda-ui/data-entries/plugins/gdaui-entry-pict.c  |   11 +--------
 libgda-ui/data-entries/plugins/gdaui-entry-rt.c    |   14 +-----------
 libgda-ui/data-entries/plugins/gdaui-entry-text.c  |   14 +-----------
 libgda-ui/gdaui-data-entry.c                       |   10 +++++++-
 libgda-ui/gdaui-data-entry.h                       |    2 +-
 18 files changed, 20 insertions(+), 162 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-bin.c b/libgda-ui/data-entries/gdaui-entry-bin.c
index abbaa9e..55a20e8 100644
--- a/libgda-ui/data-entries/gdaui-entry-bin.c
+++ b/libgda-ui/data-entries/gdaui-entry-bin.c
@@ -37,7 +37,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static void       grab_focus (GdauiEntryWrapper *mgwrap);
 
@@ -100,7 +99,6 @@ gdaui_entry_bin_class_init (GdauiEntryBinClass *class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->grab_focus = grab_focus;
 
@@ -374,12 +372,6 @@ connect_signals (GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED GCallback modify_cb,
 			  G_CALLBACK (button_clicked_cb), dbin);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-boolean.c b/libgda-ui/data-entries/gdaui-entry-boolean.c
index fff9a0f..fd24aee 100644
--- a/libgda-ui/data-entries/gdaui-entry-boolean.c
+++ b/libgda-ui/data-entries/gdaui-entry-boolean.c
@@ -34,7 +34,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static void       grab_focus (GdauiEntryWrapper *mgwrap);
 
@@ -87,7 +86,6 @@ gdaui_entry_boolean_class_init (GdauiEntryBooleanClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->grab_focus = grab_focus;
 }
@@ -257,12 +255,6 @@ check_toggled_cb (GtkToggleButton *toggle, G_GNUC_UNUSED GdauiEntryBoolean *mgbo
 	gtk_toggle_button_set_inconsistent (toggle, FALSE);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-combo.c b/libgda-ui/data-entries/gdaui-entry-combo.c
index c6782d4..2713005 100644
--- a/libgda-ui/data-entries/gdaui-entry-combo.c
+++ b/libgda-ui/data-entries/gdaui-entry-combo.c
@@ -54,7 +54,6 @@ static const GValue   *gdaui_entry_combo_get_ref_value     (GdauiDataEntry *de);
 static void            gdaui_entry_combo_set_value_default (GdauiDataEntry *de, const GValue * value);
 static void            gdaui_entry_combo_set_attributes    (GdauiDataEntry *de, guint attrs, guint mask);
 static GdaValueAttribute gdaui_entry_combo_get_attributes    (GdauiDataEntry *de);
-static gboolean        gdaui_entry_combo_can_expand  (GdauiDataEntry *de, gboolean horiz);
 static void            gdaui_entry_combo_grab_focus        (GdauiDataEntry *de);
 static void            gdaui_entry_combo_set_unknown_color (GdauiDataEntry *de, gdouble red, gdouble green,
 							    gdouble blue, gdouble alpha);
@@ -144,7 +143,6 @@ gdaui_entry_combo_data_entry_init (GdauiDataEntryIface *iface)
         iface->set_attributes = gdaui_entry_combo_set_attributes;
         iface->get_attributes = gdaui_entry_combo_get_attributes;
         iface->get_handler = NULL;
-        iface->can_expand = gdaui_entry_combo_can_expand;
 	iface->grab_focus = gdaui_entry_combo_grab_focus;
 	iface->set_unknown_color = gdaui_entry_combo_set_unknown_color;
 }
@@ -1031,19 +1029,6 @@ gdaui_entry_combo_get_attributes (GdauiDataEntry *iface)
 	return retval;
 }
 
-
-static gboolean
-gdaui_entry_combo_can_expand (GdauiDataEntry *iface, G_GNUC_UNUSED gboolean horiz)
-{
-	GdauiEntryCombo *combo;
-
-	g_return_val_if_fail (iface && GDAUI_IS_ENTRY_COMBO (iface), FALSE);
-	combo = GDAUI_ENTRY_COMBO (iface);
-	g_return_val_if_fail (combo->priv, FALSE);
-
-	return FALSE;
-}
-
 static void
 gdaui_entry_combo_grab_focus (GdauiDataEntry *iface)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 657fd72..37e93c9 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -60,7 +60,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static void       grab_focus (GdauiEntryWrapper *mgwrap);
 
@@ -139,7 +138,6 @@ gdaui_entry_common_time_class_init (GdauiEntryCommonTimeClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->grab_focus = grab_focus;
 
@@ -505,12 +503,6 @@ connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activ
 	}
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-none.c b/libgda-ui/data-entries/gdaui-entry-none.c
index f5fa88f..1e7157e 100644
--- a/libgda-ui/data-entries/gdaui-entry-none.c
+++ b/libgda-ui/data-entries/gdaui-entry-none.c
@@ -35,8 +35,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue  *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
-
 
 /* get a pointer to the parents to be able to call their destructor */
 static GObjectClass  *parent_class = NULL;
@@ -86,7 +84,6 @@ gdaui_entry_none_class_init (GdauiEntryNoneClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 }
 
 static void
@@ -221,9 +218,3 @@ connect_signals(GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED GCallback modify_cb,
 	entry = GDAUI_ENTRY_NONE (mgwrap);
 	g_return_if_fail (entry->priv);
 }
-
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
diff --git a/libgda-ui/data-entries/gdaui-entry-number.c b/libgda-ui/data-entries/gdaui-entry-number.c
index b29e120..27da545 100644
--- a/libgda-ui/data-entries/gdaui-entry-number.c
+++ b/libgda-ui/data-entries/gdaui-entry-number.c
@@ -59,7 +59,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static void       grab_focus (GdauiEntryWrapper *mgwrap);
 
@@ -133,7 +132,6 @@ gdaui_entry_number_class_init (GdauiEntryNumberClass * klass)
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (klass)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->grab_focus = grab_focus;
 
@@ -368,12 +366,6 @@ connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activ
 			  activate_cb, mgwrap);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-string.c b/libgda-ui/data-entries/gdaui-entry-string.c
index ab1e742..c70e42d 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -62,7 +62,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static void       grab_focus (GdauiEntryWrapper *mgwrap);
 
@@ -142,7 +141,6 @@ gdaui_entry_string_class_init (GdauiEntryStringClass * klass)
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (klass)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (klass)->grab_focus = grab_focus;
 
@@ -273,10 +271,12 @@ gdaui_entry_string_set_property (GObject *object,
 				if (mgstr->priv->multiline) {
 					gtk_widget_hide (mgstr->priv->entry);
 					gtk_widget_show (mgstr->priv->sw);
+					gtk_widget_set_vexpand (GTK_WIDGET (mgstr), TRUE);
 				}
 				else {
 					gtk_widget_show (mgstr->priv->entry);
 					gtk_widget_hide (mgstr->priv->sw);
+					gtk_widget_set_vexpand (GTK_WIDGET (mgstr), FALSE);
 				}
 				g_signal_emit_by_name (object, "expand-changed");
 			}
@@ -474,21 +474,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 	/* FIXME: how does the user "activates" the GtkTextView widget ? */
 }
 
-static gboolean
-can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz)
-{
-	GdauiEntryString *mgstr;
-
-	g_return_val_if_fail (GDAUI_IS_ENTRY_STRING (mgwrap), FALSE);
-	mgstr = GDAUI_ENTRY_STRING (mgwrap);
-	g_return_val_if_fail (mgstr->priv, FALSE);
-
-	if (horiz)
-		return FALSE;
-	else
-		return mgstr->priv->multiline;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-wrapper.c b/libgda-ui/data-entries/gdaui-entry-wrapper.c
index 91d158d..8090f13 100644
--- a/libgda-ui/data-entries/gdaui-entry-wrapper.c
+++ b/libgda-ui/data-entries/gdaui-entry-wrapper.c
@@ -54,7 +54,6 @@ static void            gdaui_entry_wrapper_set_value_default (GdauiDataEntry *de
 static void            gdaui_entry_wrapper_set_attributes    (GdauiDataEntry *de, GdaValueAttribute attrs, guint mask);
 static GdaValueAttribute gdaui_entry_wrapper_get_attributes  (GdauiDataEntry *de);
 static GdaDataHandler *gdaui_entry_wrapper_get_handler       (GdauiDataEntry *de);
-static gboolean        gdaui_entry_wrapper_can_expand        (GdauiDataEntry *de, gboolean horiz);
 static void            gdaui_entry_wrapper_set_editable      (GdauiDataEntry *de, gboolean editable);
 static gboolean        gdaui_entry_wrapper_get_editable      (GdauiDataEntry *de);
 static void            gdaui_entry_wrapper_grab_focus        (GdauiDataEntry *de);
@@ -137,7 +136,6 @@ gdaui_entry_wrapper_data_entry_init (GdauiDataEntryIface *iface)
 	iface->set_attributes = gdaui_entry_wrapper_set_attributes;
 	iface->get_attributes = gdaui_entry_wrapper_get_attributes;
 	iface->get_handler = gdaui_entry_wrapper_get_handler;
-	iface->can_expand = gdaui_entry_wrapper_can_expand;
 	iface->set_editable = gdaui_entry_wrapper_set_editable;
 	iface->get_editable = gdaui_entry_wrapper_get_editable;
 	iface->grab_focus = gdaui_entry_wrapper_grab_focus;
@@ -196,11 +194,6 @@ check_correct_init (GdauiEntryWrapper *wrapper)
 				   G_OBJECT_TYPE_NAME (wrapper));
 			class_impl_error = TRUE;
 		}
-		if (! klass->can_expand) {
-			g_warning ("can_expand () virtual function not implemented for object class %s\n",
-				   G_OBJECT_TYPE_NAME (wrapper));
-			class_impl_error = TRUE;
-		}
 
 		if (!class_impl_error) {
 			wrapper->priv->real_class = klass;
@@ -258,6 +251,8 @@ gdaui_entry_wrapper_init (GdauiEntryWrapper *wrapper)
 	wrapper->priv->contents_has_changed = FALSE;
 
 	wrapper->priv->set_default_if_invalid = FALSE;
+
+	gtk_widget_set_hexpand (GTK_WIDGET (wrapper), TRUE);
 }
 
 static void
@@ -828,18 +823,6 @@ gdaui_entry_wrapper_get_handler (GdauiDataEntry *iface)
 	return dh;
 }
 
-static gboolean
-gdaui_entry_wrapper_can_expand (GdauiDataEntry *iface, gboolean horiz)
-{
-	GdauiEntryWrapper *wrapper;
-
-	g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), FALSE);
-	wrapper = (GdauiEntryWrapper*) iface;
-	check_correct_init (wrapper);
-
-	return (wrapper->priv->real_class->can_expand) (wrapper, horiz);
-}
-
 static void
 gdaui_entry_wrapper_set_editable (GdauiDataEntry *iface, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/gdaui-entry-wrapper.h b/libgda-ui/data-entries/gdaui-entry-wrapper.h
index 27a6683..ee06e38 100644
--- a/libgda-ui/data-entries/gdaui-entry-wrapper.h
+++ b/libgda-ui/data-entries/gdaui-entry-wrapper.h
@@ -55,7 +55,7 @@ struct _GdauiEntryWrapperClass
 	void              (*real_set_value)   (GdauiEntryWrapper *wrapper, const GValue *value);
 	GValue           *(*real_get_value)   (GdauiEntryWrapper *wrapper);
 	void              (*connect_signals)  (GdauiEntryWrapper *wrapper, GCallback modify_cb, GCallback activate_cb);
-	gboolean          (*can_expand)       (GdauiEntryWrapper *wrapper, gboolean horiz);
+	gboolean          (*can_expand)       (GdauiEntryWrapper *wrapper, gboolean horiz); /* not used anymore */
 	void              (*set_editable)     (GdauiEntryWrapper *wrapper, gboolean editable);
 
 	gboolean          (*value_is_equal_to)(GdauiEntryWrapper *wrapper, const GValue *value);
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c b/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
index 4a71efd..b45252f 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-cidr.c
@@ -37,7 +37,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 
 /* get a pointer to the parents to be able to call their destructor */
 static GObjectClass  *parent_class = NULL;
@@ -103,7 +102,6 @@ gdaui_entry_cidr_class_init (GdauiEntryCidrClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 }
 
 static void
@@ -591,13 +589,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 	g_signal_connect (G_OBJECT (mgcidr->priv->entry), "activate", activate_cb, mgwrap);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
-
 static SplitValues *
 split_values_get (GdauiEntryCidr *mgcidr)
 {
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-filesel.c b/libgda-ui/data-entries/plugins/gdaui-entry-filesel.c
index 6667bd7..3614f0e 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-filesel.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-filesel.c
@@ -37,7 +37,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 
 /* get a pointer to the parents to be able to call their destructor */
@@ -89,7 +88,6 @@ gdaui_entry_filesel_class_init (GdauiEntryFileselClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;	
 }
 
@@ -318,12 +316,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 			  activate_cb, mgwrap);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-format.c b/libgda-ui/data-entries/plugins/gdaui-entry-format.c
index bbcf9b8..b9a840a 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-format.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-format.c
@@ -36,7 +36,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 
 /* get a pointer to the parents to be able to call their destructor */
 static GObjectClass  *parent_class = NULL;
@@ -88,7 +87,6 @@ gdaui_entry_format_class_init (GdauiEntryFormatClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 }
 
 static void
@@ -255,9 +253,3 @@ connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activ
 	g_signal_connect (G_OBJECT (mgformat->priv->entry), "changed", modify_cb, mgwrap);
 	g_signal_connect (G_OBJECT (mgformat->priv->entry), "activate", activate_cb, mgwrap);
 }
-
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-password.c b/libgda-ui/data-entries/plugins/gdaui-entry-password.c
index 5d52dac..e0649f2 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-password.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-password.c
@@ -35,7 +35,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 
 static void signal_handlers_block (GdauiEntryPassword *mgstr);
 static void signal_handlers_unblock (GdauiEntryPassword *mgstr);
@@ -95,7 +94,6 @@ gdaui_entry_password_class_init (GdauiEntryPasswordClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 }
 
 static void
@@ -297,12 +295,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
                           activate_cb, mgwrap);
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return FALSE;
-}
-
 static void 
 signal_handlers_block (GdauiEntryPassword *mgstr)
 {
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
index 7384d51..6f24010 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
@@ -46,7 +46,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 static gboolean   value_is_equal_to (GdauiEntryWrapper *mgwrap, const GValue *value);
 static gboolean   value_is_null (GdauiEntryWrapper *mgwrap);
@@ -107,14 +106,13 @@ gdaui_entry_pict_class_init (GdauiEntryPictClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->value_is_equal_to = value_is_equal_to;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->value_is_null = value_is_null;
 }
 
 static void
-gdaui_entry_pict_init (GdauiEntryPict * gdaui_entry_pict)
+gdaui_entry_pict_init (GdauiEntryPict *gdaui_entry_pict)
 {
 	gdaui_entry_pict->priv = g_new0 (GdauiEntryPictPrivate, 1);
 	gdaui_entry_pict->priv->pict = NULL;
@@ -126,6 +124,7 @@ gdaui_entry_pict_init (GdauiEntryPict * gdaui_entry_pict)
 	gdaui_entry_pict->priv->editable = TRUE;
 	gdaui_entry_pict->priv->size.width = 0;
 	gdaui_entry_pict->priv->size.height = 0;
+	gtk_widget_set_vexpand (GTK_WIDGET (gdaui_entry_pict), TRUE);
 }
 
 /**
@@ -448,12 +447,6 @@ connect_signals(G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED GCallback
 	/* do nothing because we manually call gdaui_entry_wrapper_contents_changed() */
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, G_GNUC_UNUSED gboolean horiz)
-{
-	return TRUE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-rt.c b/libgda-ui/data-entries/plugins/gdaui-entry-rt.c
index 7821e38..4ca57fe 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-rt.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-rt.c
@@ -37,7 +37,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 
 /* get a pointer to the parents to be able to call their destructor */
@@ -88,15 +87,15 @@ gdaui_entry_rt_class_init (GdauiEntryRtClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 }
 
 static void
-gdaui_entry_rt_init (GdauiEntryRt * gdaui_entry_rt)
+gdaui_entry_rt_init (GdauiEntryRt *gdaui_entry_rt)
 {
 	gdaui_entry_rt->priv = g_new0 (GdauiEntryRtPrivate, 1);
 	gdaui_entry_rt->priv->view = NULL;
+	gtk_widget_set_vexpand (GTK_WIDGET (gdaui_entry_rt), TRUE);
 }
 
 /**
@@ -282,15 +281,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 	/* FIXME: how does the user "activates" the GtkRtView widget ? */
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, gboolean horiz)
-{
-	if (horiz)
-		return FALSE;
-	else
-		return TRUE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-text.c b/libgda-ui/data-entries/plugins/gdaui-entry-text.c
index 4bb3ec4..e359820 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-text.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-text.c
@@ -50,7 +50,6 @@ static GtkWidget *create_entry (GdauiEntryWrapper *mgwrap);
 static void       real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value);
 static GValue    *real_get_value (GdauiEntryWrapper *mgwrap);
 static void       connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
-static gboolean   can_expand (GdauiEntryWrapper *mgwrap, gboolean horiz);
 static void       set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
 
 /* get a pointer to the parents to be able to call their destructor */
@@ -104,17 +103,17 @@ gdaui_entry_text_class_init (GdauiEntryTextClass * class)
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_set_value = real_set_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
-	GDAUI_ENTRY_WRAPPER_CLASS (class)->can_expand = can_expand;
 	GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
 }
 
 static void
-gdaui_entry_text_init (GdauiEntryText * gdaui_entry_text)
+gdaui_entry_text_init (GdauiEntryText *gdaui_entry_text)
 {
 	gdaui_entry_text->priv = g_new0 (GdauiEntryTextPrivate, 1);
 	gdaui_entry_text->priv->buffer = NULL;
 	gdaui_entry_text->priv->view = NULL;
 	gdaui_entry_text->priv->wrapmode = GTK_WRAP_NONE;
+	gtk_widget_set_vexpand (GTK_WIDGET (gdaui_entry_text), TRUE);
 }
 
 /**
@@ -410,15 +409,6 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 	/* FIXME: how does the user "activates" the GtkTextView widget ? */
 }
 
-static gboolean
-can_expand (G_GNUC_UNUSED GdauiEntryWrapper *mgwrap, gboolean horiz)
-{
-	if (horiz)
-		return FALSE;
-	else
-		return TRUE;
-}
-
 static void
 set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
 {
diff --git a/libgda-ui/gdaui-data-entry.c b/libgda-ui/gdaui-data-entry.c
index 1b4844f..9c8fae7 100644
--- a/libgda-ui/gdaui-data-entry.c
+++ b/libgda-ui/gdaui-data-entry.c
@@ -64,6 +64,7 @@ gdaui_data_entry_get_type (void)
 		};
 
 		type = g_type_register_static (G_TYPE_INTERFACE, "GdauiDataEntry", &info, 0);
+		g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
 	}
 	return type;
 }
@@ -415,6 +416,8 @@ gdaui_data_entry_get_handler (GdauiDataEntry *de)
  * Returns: %TRUE if the widget requires expansion
  *
  * Since: 4.2
+ *
+ * Deprecated: 5.2: use the GtkWidget "hexpand", "wexpand" or "expand" properties
  */
 gboolean
 gdaui_data_entry_can_expand (GdauiDataEntry *de, gboolean horiz)
@@ -422,9 +425,12 @@ gdaui_data_entry_can_expand (GdauiDataEntry *de, gboolean horiz)
 	g_return_val_if_fail (GDAUI_IS_DATA_ENTRY (de), FALSE);
 
 	if (GDAUI_DATA_ENTRY_GET_IFACE (de)->can_expand)
-		return (GDAUI_DATA_ENTRY_GET_IFACE (de)->can_expand) (de, horiz);
+		g_warning ("The GdauiDataEntry::can_expand virtual method is not used anymore, "
+			   "please clean your code");
+	if (horiz)
+		return gtk_widget_get_hexpand ((GtkWidget*) de);
 	else
-		return FALSE;
+		return gtk_widget_get_vexpand ((GtkWidget*) de);
 }
 
 /**
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index 5893856..06f4b75 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -67,7 +67,7 @@ struct _GdauiDataEntryIface
 	void            (*set_attributes)        (GdauiDataEntry *de, GdaValueAttribute attrs, GdaValueAttribute mask);
 	GdaValueAttribute (*get_attributes)      (GdauiDataEntry *de);
 	GdaDataHandler *(*get_handler)           (GdauiDataEntry *de);
-	gboolean        (*can_expand)            (GdauiDataEntry *de, gboolean horiz);
+	gboolean        (*can_expand)            (GdauiDataEntry *de, gboolean horiz); /* not used anymore */
 	void            (*set_editable)          (GdauiDataEntry *de, gboolean editable);
 	gboolean        (*get_editable)          (GdauiDataEntry *de);
 	void            (*grab_focus)            (GdauiDataEntry *de);



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