[libgda/LIBGDA_4.2] Don't emit the "contents-activated" signal on focus out



commit 6bdd2be50c2e1e3ae540428284ba34e70dfac64e
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun May 22 17:59:57 2011 +0200

    Don't emit the "contents-activated" signal on focus out

 libgda-ui/data-entries/gdaui-entry-common-time.c |   18 -----------
 libgda-ui/data-entries/gdaui-entry-number.c      |   26 ++---------------
 libgda-ui/data-entries/gdaui-entry-string.c      |   34 ++-------------------
 3 files changed, 7 insertions(+), 71 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 7da3307..a130555 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -474,18 +474,6 @@ real_get_value (GdauiEntryWrapper *mgwrap)
 	return value;
 }
 
-typedef void (*Callback2) (gpointer, gpointer);
-static gboolean
-focus_out_cb (GtkWidget *widget, GdkEventFocus *event, GdauiEntryCommonTime *mgtim)
-{
-	GCallback activate_cb;
-	activate_cb = g_object_get_data (G_OBJECT (widget), "_activate_cb");
-	g_assert (activate_cb);
-	((Callback2)activate_cb) (widget, mgtim);
-
-	return gtk_widget_event (GTK_WIDGET (mgtim), (GdkEvent*) event);
-}
-
 static void
 connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb)
 {
@@ -499,23 +487,17 @@ connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activ
 	type = gdaui_data_entry_get_value_type (GDAUI_DATA_ENTRY (mgtim));
 
 	if ((type == G_TYPE_DATE) || (type == GDA_TYPE_TIMESTAMP)) {
-		g_object_set_data (G_OBJECT (mgtim->priv->entry_date), "_activate_cb", activate_cb);
 		g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "changed",
 				  modify_cb, mgwrap);
 		g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "activate",
 				  activate_cb, mgwrap);
-		g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "focus-out-event",
-				  G_CALLBACK (focus_out_cb), mgtim);
 	}
 
 	if ((type == GDA_TYPE_TIME) || (type == GDA_TYPE_TIMESTAMP)) {
-		g_object_set_data (G_OBJECT (mgtim->priv->entry_time), "_activate_cb", activate_cb);
 		g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "changed",
 				  modify_cb, mgwrap);
 		g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "activate",
 				  activate_cb, mgwrap);
-		g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "focus-out-event",
-				  G_CALLBACK (focus_out_cb), mgtim);
 	}
 }
 
diff --git a/libgda-ui/data-entries/gdaui-entry-number.c b/libgda-ui/data-entries/gdaui-entry-number.c
index 3e00090..dff7742 100644
--- a/libgda-ui/data-entries/gdaui-entry-number.c
+++ b/libgda-ui/data-entries/gdaui-entry-number.c
@@ -1,6 +1,5 @@
-/* gdaui-entry-number.c
- *
- * Copyright (C) 2009 - 2010 Vivien Malerba
+/*
+ * Copyright (C) 2009 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -212,7 +211,6 @@ gdaui_entry_number_new (GdaDataHandler *dh, GType type, const gchar *options)
 	return GTK_WIDGET (obj);
 }
 
-static gboolean focus_out_cb (GtkWidget *widget, GdkEventFocus *event, GdauiEntryNumber *mgstr);
 static void
 gdaui_entry_number_dispose (GObject   * object)
 {
@@ -223,11 +221,8 @@ gdaui_entry_number_dispose (GObject   * object)
 
 	mgstr = GDAUI_ENTRY_NUMBER (object);
 	if (mgstr->priv) {
-		if (mgstr->priv->entry) {
-			g_signal_handlers_disconnect_by_func (G_OBJECT (mgstr->priv->entry),
-							      G_CALLBACK (focus_out_cb), mgstr);
+		if (mgstr->priv->entry)
 			mgstr->priv->entry = NULL;
-		}
 	}
 
 	/* parent class */
@@ -354,18 +349,6 @@ real_get_value (GdauiEntryWrapper *mgwrap)
 	return value;
 }
 
-typedef void (*Callback2) (gpointer, gpointer);
-static gboolean
-focus_out_cb (GtkWidget *widget, GdkEventFocus *event, GdauiEntryNumber *mgstr)
-{
-	GCallback activate_cb;
-	activate_cb = g_object_get_data (G_OBJECT (widget), "_activate_cb");
-	g_assert (activate_cb);
-	((Callback2)activate_cb) (widget, mgstr);
-
-	return gtk_widget_event (GTK_WIDGET (mgstr), (GdkEvent*) event);
-}
-
 static void
 connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb)
 {
@@ -374,14 +357,11 @@ connect_signals (GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activ
 	g_return_if_fail (GDAUI_IS_ENTRY_NUMBER (mgwrap));
 	mgstr = GDAUI_ENTRY_NUMBER (mgwrap);
 	g_return_if_fail (mgstr->priv);
-	g_object_set_data (G_OBJECT (mgstr->priv->entry), "_activate_cb", activate_cb);
 
 	mgstr->priv->entry_change_sig = g_signal_connect (G_OBJECT (mgstr->priv->entry), "changed",
 							  modify_cb, mgwrap);
 	g_signal_connect (G_OBJECT (mgstr->priv->entry), "activate",
 			  activate_cb, mgwrap);
-	g_signal_connect (G_OBJECT (mgstr->priv->entry), "focus-out-event",
-			  G_CALLBACK (focus_out_cb), mgstr);
 }
 
 static gboolean
diff --git a/libgda-ui/data-entries/gdaui-entry-string.c b/libgda-ui/data-entries/gdaui-entry-string.c
index 37f3c48..76d13ca 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -1,6 +1,5 @@
-/* gdaui-entry-string.c
- *
- * Copyright (C) 2003 - 2010 Vivien Malerba
+/*
+ * Copyright (C) 2003 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -216,7 +215,6 @@ gdaui_entry_string_new (GdaDataHandler *dh, GType type, const gchar *options)
 	return GTK_WIDGET (obj);
 }
 
-static gboolean focus_out_cb (GtkWidget *widget, GdkEventFocus *event, GdauiEntryString *mgstr);
 static void
 gdaui_entry_string_dispose (GObject   * object)
 {
@@ -227,17 +225,11 @@ gdaui_entry_string_dispose (GObject   * object)
 
 	mgstr = GDAUI_ENTRY_STRING (object);
 	if (mgstr->priv) {
-		if (mgstr->priv->entry) {
-			g_signal_handlers_disconnect_by_func (G_OBJECT (mgstr->priv->entry),
-							      G_CALLBACK (focus_out_cb), mgstr);
+		if (mgstr->priv->entry)
 			mgstr->priv->entry = NULL;
-		}
 		
-		if (mgstr->priv->view) {
-			g_signal_handlers_disconnect_by_func (G_OBJECT (mgstr->priv->view),
-							      G_CALLBACK (focus_out_cb), mgstr);
+		if (mgstr->priv->view)
 			mgstr->priv->view = NULL;
-		}
 	}
 
 	/* parent class */
@@ -458,18 +450,6 @@ real_get_value (GdauiEntryWrapper *mgwrap)
 	return value;
 }
 
-typedef void (*Callback2) (gpointer, gpointer);
-static gboolean
-focus_out_cb (GtkWidget *widget, GdkEventFocus *event, GdauiEntryString *mgstr)
-{
-	GCallback activate_cb;
-	activate_cb = g_object_get_data (G_OBJECT (widget), "_activate_cb");
-	g_assert (activate_cb);
-	((Callback2)activate_cb) (widget, mgstr);
-
-	return gtk_widget_event (GTK_WIDGET (mgstr), (GdkEvent*) event);
-}
-
 static void
 connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb)
 {
@@ -478,20 +458,14 @@ connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activa
 	g_return_if_fail (GDAUI_IS_ENTRY_STRING (mgwrap));
 	mgstr = GDAUI_ENTRY_STRING (mgwrap);
 	g_return_if_fail (mgstr->priv);
-	g_object_set_data (G_OBJECT (mgstr->priv->entry), "_activate_cb", activate_cb);
-	g_object_set_data (G_OBJECT (mgstr->priv->view), "_activate_cb", activate_cb);
 
 	mgstr->priv->entry_change_sig = g_signal_connect (G_OBJECT (mgstr->priv->entry), "changed",
 							  modify_cb, mgwrap);
 	g_signal_connect (G_OBJECT (mgstr->priv->entry), "activate",
 			  activate_cb, mgwrap);
-	g_signal_connect (G_OBJECT (mgstr->priv->entry), "focus-out-event",
-			  G_CALLBACK (focus_out_cb), mgstr);
 
 	g_signal_connect (G_OBJECT (mgstr->priv->buffer), "changed",
 			  modify_cb, mgwrap);
-	g_signal_connect (G_OBJECT (mgstr->priv->view), "focus-out-event",
-			  G_CALLBACK (focus_out_cb), mgstr);
 	/* FIXME: how does the user "activates" the GtkTextView widget ? */
 }
 



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