[farsight2/master] Define error enum and quark for FsSession

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:19:05 PST 2008


---
 gst-libs/gst/farsight/fs-session.c |   21 +++++++++++++++++++--
 gst-libs/gst/farsight/fs-session.h |   19 +++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/gst-libs/gst/farsight/fs-session.c b/gst-libs/gst/farsight/fs-session.c
index e9a5fd1..50f5c9c 100644
--- a/gst-libs/gst/farsight/fs-session.c
+++ b/gst-libs/gst/farsight/fs-session.c
@@ -95,6 +95,13 @@ static void fs_session_set_property (GObject *object,
 static GObjectClass *parent_class = NULL;
 static guint signals[LAST_SIGNAL] = { 0 };
 
+GQuark
+fs_session_error_quark (void)
+{
+  return g_quark_from_static_string ("fs-session-error");
+}
+
+
 GType
 fs_session_get_type (void)
 {
@@ -256,11 +263,12 @@ fs_session_class_init (FsSessionClass *klass)
    * FsSession::error:
    * @self: #FsSession that emitted the signal
    * @object: The #Gobject that emitted the signal
-   * @error_no: The number of the error 
+   * @error_no: The number of the error
    * @error_msg: Error message to be displayed to user
    * @debug_msg: Debugging error message
    *
-   * This signal is emitted in any error condition
+   * This signal is emitted in any error condition, it can be emitted on any
+   * thread. Applications should listen to the GstBus for errors.
    *
    */
   signals[ERROR] = g_signal_new ("error",
@@ -537,3 +545,12 @@ fs_session_set_send_codec (FsSession *session, FsCodec *send_codec,
   }
   return FALSE;
 }
+
+
+void
+fs_session_error (FsSession *session, gint error_no, gchar *error_msg,
+                  gchar *debug_msg)
+{
+  g_signal_emit (session, signals[ERROR], 0, session, error_no, error_msg,
+                 debug_msg, NULL);
+}
diff --git a/gst-libs/gst/farsight/fs-session.h b/gst-libs/gst/farsight/fs-session.h
index 52a43dd..f3d5962 100644
--- a/gst-libs/gst/farsight/fs-session.h
+++ b/gst-libs/gst/farsight/fs-session.h
@@ -99,6 +99,22 @@ typedef enum
   FS_DTMF_METHOD_IN_BAND
 } FsDTMFMethod;
 
+/**
+ * FsSessionError:
+ * @FS_SESSION_ERROR_CONSTRUCTION: Error constructing some of the sub-elements
+ *
+ * This is the enum of error numbers that will come either on the "error" signal
+ * or from the Gst Bus.
+ */
+
+typedef enum {
+  FS_SESSION_ERROR_CONSTRUCTION
+} FsSessionError;
+
+#define FS_SESSION_ERROR (fs_session_error_quark ())
+
+GQuark fs_session_error_quark (void);
+
 struct _FsSessionClass
 {
   GObjectClass parent_class;
@@ -152,6 +168,9 @@ gboolean fs_session_stop_telephony_event (FsSession *session,
 gboolean fs_session_set_send_codec (FsSession *session, FsCodec *send_codec,
                                     GError **error);
 
+void fs_session_error (FsSession *session, gint error_no, gchar *error_msg,
+                       gchar *debug_msg);
+
 G_END_DECLS
 
 #endif /* __FS_SESSION_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list