[libgda] Renamed some GdaConnection signals, and removed the "conn-to-close" one



commit 3c08ad25fc5b6859bdb80d0b2800e99c5a232bfd
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Apr 2 18:50:07 2014 +0200

    Renamed some GdaConnection signals, and removed the "conn-to-close" one

 libgda/gda-connection-internal.h                   |    1 -
 libgda/gda-connection.c                            |   68 ++++---------------
 libgda/gda-connection.h                            |    5 +-
 libgda/gda-server-provider.c                       |    2 +-
 libgda/sqlite/virtual/gda-ldap-connection.c        |    2 +-
 libgda/sqlite/virtual/gda-vconnection-data-model.c |    4 +-
 libgda/sqlite/virtual/gda-vconnection-hub.c        |    4 +-
 libgda/sqlite/virtual/gda-virtual-connection.c     |    2 +-
 libgda/sqlite/virtual/gda-vprovider-data-model.c   |    4 +-
 9 files changed, 26 insertions(+), 66 deletions(-)
---
diff --git a/libgda/gda-connection-internal.h b/libgda/gda-connection-internal.h
index a7e0859..b264a18 100644
--- a/libgda/gda-connection-internal.h
+++ b/libgda/gda-connection-internal.h
@@ -43,7 +43,6 @@ G_BEGIN_DECLS
 /*
  * Misc.
  */
-gboolean           _gda_connection_close_no_warning (GdaConnection *cnc, GError **error);
 GdaWorker         *_gda_connection_get_worker (GdaConnection *cnc);
 guint              _gda_connection_get_exec_slowdown (GdaConnection *cnc);
 
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 8096166..ba2e8ab 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -147,16 +147,15 @@ static void change_events_array_max_size (GdaConnection *cnc, gint size);
 
 enum {
        ERROR,
-       CONN_OPENED,
-        CONN_TO_CLOSE,
-        CONN_CLOSED,
+       OPENED,
+        CLOSED,
        DSN_CHANGED,
        TRANSACTION_STATUS_CHANGED,
        STATUS_CHANGED,
        LAST_SIGNAL
 };
 
-static gint gda_connection_signals[LAST_SIGNAL] = { 0, 0, 0, 0, 0, 0, 0 };
+static gint gda_connection_signals[LAST_SIGNAL] = { 0, 0, 0, 0, 0, 0 };
 
 /* properties */
 enum
@@ -231,44 +230,30 @@ gda_connection_class_init (GdaConnectionClass *klass)
                              g_cclosure_marshal_VOID__OBJECT,
                              G_TYPE_NONE, 1, GDA_TYPE_CONNECTION_EVENT);
        /**
-        * GdaConnection::conn-opened:
+        * GdaConnection::opened:
         * @cnc: the #GdaConnection
         *
         * Gets emitted when the connection has been opened to the database
         */
-       gda_connection_signals[CONN_OPENED] =
-                g_signal_new ("conn-opened",
+       gda_connection_signals[OPENED] =
+                g_signal_new ("opened",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdaConnectionClass, conn_opened),
+                              G_STRUCT_OFFSET (GdaConnectionClass, opened),
                               NULL, NULL,
                               _gda_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
        /**
-        * GdaConnection::conn-to-close:
-        * @cnc: the #GdaConnection
-        *
-        * Gets emitted when the connection to the database is about to be closed
-        */
-        gda_connection_signals[CONN_TO_CLOSE] =
-                g_signal_new ("conn-to-close",
-                              G_TYPE_FROM_CLASS (object_class),
-                              G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdaConnectionClass, conn_to_close),
-                              NULL, NULL,
-                              _gda_marshal_VOID__VOID,
-                              G_TYPE_NONE, 0);
-       /**
-        * GdaConnection::conn-closed:
+        * GdaConnection::closed:
         * @cnc: the #GdaConnection
         *
         * Gets emitted when the connection to the database has been closed
         */
-        gda_connection_signals[CONN_CLOSED] =    /* runs after user handlers */
-                g_signal_new ("conn-closed",
+        gda_connection_signals[CLOSED] =    /* runs after user handlers */
+                g_signal_new ("closed",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (GdaConnectionClass, conn_closed),
+                              G_STRUCT_OFFSET (GdaConnectionClass, closed),
                               NULL, NULL,
                               _gda_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
@@ -482,7 +467,7 @@ gda_connection_dispose (GObject *object)
        g_return_if_fail (GDA_IS_CONNECTION (cnc));
 
        /* free memory */
-       _gda_connection_close_no_warning (cnc, NULL);
+       gda_connection_close (cnc, NULL);
 
        if (cnc->priv->context_hash) {
                g_hash_table_destroy (cnc->priv->context_hash);
@@ -1308,7 +1293,7 @@ gda_connection_open_sqlite (const gchar *directory, const gchar *filename, gbool
 
        if (auto_unlink) {
                g_object_set_data_full (G_OBJECT (cnc), "__gda_fname", fname, g_free);
-               g_signal_connect (cnc, "conn-closed",
+               g_signal_connect (cnc, "closed",
                                  G_CALLBACK (sqlite_connection_closed_cb), NULL);
        }
        else
@@ -1487,8 +1472,7 @@ add_connection_event_from_error (GdaConnection *cnc, GError **error)
  * gda_connection_close:
  * @cnc: a #GdaConnection object.
  *
- * Closes the connection to the underlying data source, but first emits the 
- * "conn-to-close" signal.
+ * Closes the connection to the underlying data source.
  */
 gboolean
 gda_connection_close (GdaConnection *cnc, GError **error)
@@ -1498,28 +1482,6 @@ gda_connection_close (GdaConnection *cnc, GError **error)
        if (! cnc->priv->provider_data)
                return TRUE;
 
-#ifdef GDA_DEBUG_signal
-        g_print (">> 'CONN_TO_CLOSE' from %s\n", __FUNCTION__);
-#endif
-        g_signal_emit (G_OBJECT (cnc), gda_connection_signals[CONN_TO_CLOSE], 0);
-#ifdef GDA_DEBUG_signal
-        g_print ("<< 'CONN_TO_CLOSE' from %s\n", __FUNCTION__);
-#endif
-
-        return _gda_connection_close_no_warning (cnc, error);
-}
-
-/*
- * _gda_connection_close_no_warning:
- * @cnc: a #GdaConnection object.
- *
- * Closes the connection to the underlying data source, without emiting any warning signal.
- */
-gboolean
-_gda_connection_close_no_warning (GdaConnection *cnc, GError **error)
-{
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-
        g_object_ref (cnc);
        gda_connection_lock ((GdaLockable*) cnc);
 
@@ -1638,7 +1600,7 @@ _gda_connection_set_status (GdaConnection *cnc, GdaConnectionStatus status)
        cnc->priv->status = status;
        g_signal_emit (G_OBJECT (cnc), gda_connection_signals[STATUS_CHANGED], 0, status);
        if (status == GDA_CONNECTION_STATUS_CLOSED)
-               g_signal_emit (G_OBJECT (cnc), gda_connection_signals[CONN_CLOSED], 0, status);
+               g_signal_emit (G_OBJECT (cnc), gda_connection_signals[CLOSED], 0, status);
 }
 
 /*
diff --git a/libgda/gda-connection.h b/libgda/gda-connection.h
index dc0eb6f..696640b 100644
--- a/libgda/gda-connection.h
+++ b/libgda/gda-connection.h
@@ -131,9 +131,8 @@ struct _GdaConnectionClass {
        /* signals */
        void   (*status_changed)            (GdaConnection *obj, GdaConnectionStatus status);
        void   (*error)                     (GdaConnection *cnc, GdaConnectionEvent *error);
-        void   (*conn_opened)               (GdaConnection *obj);
-        void   (*conn_to_close)             (GdaConnection *obj);
-        void   (*conn_closed)               (GdaConnection *obj);
+        void   (*opened)                    (GdaConnection *obj);
+        void   (*closed)                    (GdaConnection *obj);
        void   (*dsn_changed)               (GdaConnection *obj);
        void   (*transaction_status_changed)(GdaConnection *obj);
 
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index e4636f7..c9608f0 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -2078,7 +2078,7 @@ stage2_open_connection (GdaWorker *worker, GdaConnection *cnc, gpointer result)
                        _gda_connection_set_status (cnc, GDA_CONNECTION_STATUS_CLOSED);
                }
                else {
-                       g_signal_emit_by_name (G_OBJECT (cnc), "conn-opened");
+                       g_signal_emit_by_name (G_OBJECT (cnc), "opened");
                        _gda_connection_status_stop_batch (cnc);
                }
        }
diff --git a/libgda/sqlite/virtual/gda-ldap-connection.c b/libgda/sqlite/virtual/gda-ldap-connection.c
index cf205b0..47de553 100644
--- a/libgda/sqlite/virtual/gda-ldap-connection.c
+++ b/libgda/sqlite/virtual/gda-ldap-connection.c
@@ -268,7 +268,7 @@ gda_ldap_connection_init (GdaLdapConnection *cnc, G_GNUC_UNUSED GdaLdapConnectio
 
        g_signal_connect (cnc, "notify::dsn",
                          G_CALLBACK (dsn_set_cb), NULL);
-       g_signal_connect (cnc, "conn-opened",
+       g_signal_connect (cnc, "opened",
                          G_CALLBACK (conn_opened_cb), NULL);
 }
 
diff --git a/libgda/sqlite/virtual/gda-vconnection-data-model.c 
b/libgda/sqlite/virtual/gda-vconnection-data-model.c
index 08319c2..fad927e 100644
--- a/libgda/sqlite/virtual/gda-vconnection-data-model.c
+++ b/libgda/sqlite/virtual/gda-vconnection-data-model.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 - 2013 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2007 - 2014 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
  * Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
  * Copyright (C) 2010 David King <davidk openismus com>
@@ -158,7 +158,7 @@ gda_vconnection_data_model_dispose (GObject *object)
                        td = (GdaVConnectionTableData *) cnc->priv->table_data_list->data;
                        get_rid_of_vtable (cnc, td, TRUE, NULL);
                }
-               _gda_connection_close_no_warning ((GdaConnection *) cnc, NULL);
+               gda_connection_close ((GdaConnection *) cnc, NULL);
 
                g_mutex_clear (& (cnc->priv->lock_context));
                g_free (cnc->priv);
diff --git a/libgda/sqlite/virtual/gda-vconnection-hub.c b/libgda/sqlite/virtual/gda-vconnection-hub.c
index bbf3672..ae0a833 100644
--- a/libgda/sqlite/virtual/gda-vconnection-hub.c
+++ b/libgda/sqlite/virtual/gda-vconnection-hub.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2007 - 2014 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2008 - 2011 Murray Cumming <murrayc murrayc com>
  * Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
  * Copyright (C) 2010 David King <davidk openismus com>
@@ -87,7 +87,7 @@ gda_vconnection_hub_dispose (GObject *object)
 
        /* free memory */
        if (cnc->priv) {
-               _gda_connection_close_no_warning ((GdaConnection *) cnc, NULL);
+               gda_connection_close ((GdaConnection *) cnc, NULL);
                g_assert (!cnc->priv->hub_connections);
 
                g_free (cnc->priv);
diff --git a/libgda/sqlite/virtual/gda-virtual-connection.c b/libgda/sqlite/virtual/gda-virtual-connection.c
index c832662..d6f57b8 100644
--- a/libgda/sqlite/virtual/gda-virtual-connection.c
+++ b/libgda/sqlite/virtual/gda-virtual-connection.c
@@ -66,7 +66,7 @@ gda_virtual_connection_class_init (GdaVirtualConnectionClass *klass)
 
        /* virtual methods */
        object_class->finalize = gda_virtual_connection_finalize;
-       GDA_CONNECTION_CLASS (klass)->conn_closed = (void (*) (GdaConnection*)) conn_closed_cb;
+       GDA_CONNECTION_CLASS (klass)->closed = (void (*) (GdaConnection*)) conn_closed_cb;
 }
 
 static void
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c 
b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 6a3ef39..8f92593 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2007 - 2014 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2009 Bas Driessen <bas driessen xobas com>
  * Copyright (C) 2010 David King <davidk openismus com>
  *
@@ -415,7 +415,7 @@ gda_vprovider_data_model_open_connection (GdaServerProvider *provider, GdaConnec
        SqliteConnectionData *scnc;
        scnc = (SqliteConnectionData*) gda_connection_internal_get_provider_data_error ((GdaConnection *) 
cnc, NULL);
        if (!scnc) {
-               _gda_connection_close_no_warning (cnc, NULL);
+               gda_connection_close (cnc, NULL);
                gda_connection_add_event_string (cnc, _("Connection is closed"));
                return FALSE;
        }


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