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



commit a334aff80183f02f3f3a0486929d9b6aa9e45948
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun May 22 17:46:38 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      |   24 +---------------
 libgda-ui/data-entries/gdaui-entry-string.c      |   32 ++-------------------
 3 files changed, 5 insertions(+), 69 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index eff9065..7823c58 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -477,18 +477,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)
 {
@@ -502,23 +490,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 6bfa916..a0345a6 100644
--- a/libgda-ui/data-entries/gdaui-entry-number.c
+++ b/libgda-ui/data-entries/gdaui-entry-number.c
@@ -1,5 +1,4 @@
-/* gdaui-entry-number.c
- *
+/*
  * Copyright (C) 2009 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
@@ -213,7 +212,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)
 {
@@ -224,11 +222,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 */
@@ -358,18 +353,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)
 {
@@ -378,14 +361,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 4ce2d68..fbd939e 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -1,5 +1,4 @@
-/* gdaui-entry-string.c
- *
+/*
  * Copyright (C) 2003 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
@@ -217,7 +216,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)
 {
@@ -228,17 +226,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 */
@@ -462,18 +454,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)
 {
@@ -482,20 +462,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]