telepathygabble/src/tp-channel-factory-iface.c
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /*
       
     2  * tp-channel-factory-iface.c - Stubs for Telepathy Channel Factory interface
       
     3  *
       
     4  * Copyright (C) 2006 Collabora Ltd.
       
     5  * 
       
     6  *
       
     7  * This library is free software; you can redistribute it and/or
       
     8  * modify it under the terms of the GNU Lesser General Public
       
     9  * License as published by the Free Software Foundation; either
       
    10  * version 2.1 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This library is distributed in the hope that it will be useful,
       
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15  * Lesser General Public License for more details.
       
    16  *
       
    17  * You should have received a copy of the GNU Lesser General Public
       
    18  * License along with this library; if not, write to the Free Software
       
    19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    20  */
       
    21 
       
    22 #include <glib-object.h>
       
    23 
       
    24 #include "tp-channel-factory-iface.h"
       
    25 #include "tp-channel-factory-iface-signals-marshal.h"
       
    26 #include "tp-channel-iface.h"
       
    27 
       
    28 
       
    29 #ifdef EMULATOR
       
    30 #include "libgabble_wsd_solution.h"
       
    31 
       
    32 	GET_STATIC_VAR_FROM_TLS(initialized,gabble_fac_iface,gboolean)
       
    33 	#define initialized (*GET_WSD_VAR_NAME(initialized,gabble_fac_iface, s)())	
       
    34 
       
    35 	GET_STATIC_VAR_FROM_TLS(type,gabble_fac_iface,GType)
       
    36 	#define type (*GET_WSD_VAR_NAME(type,gabble_fac_iface, s)())	
       
    37 
       
    38 #endif
       
    39 
       
    40 
       
    41 static void
       
    42 tp_channel_factory_iface_base_init (gpointer klass)
       
    43 {
       
    44 #ifndef EMULATOR
       
    45   static gboolean initialized = FALSE;
       
    46 #endif
       
    47 
       
    48   if (!initialized) {
       
    49     initialized = TRUE;
       
    50 
       
    51     g_signal_new ("new-channel",
       
    52                   G_OBJECT_CLASS_TYPE (klass),
       
    53                   G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
       
    54                   0,
       
    55                   NULL, NULL,
       
    56                   g_cclosure_marshal_VOID__OBJECT,
       
    57                   G_TYPE_NONE, 1, G_TYPE_OBJECT);
       
    58 
       
    59     g_signal_new ("channel-error",
       
    60                   G_OBJECT_CLASS_TYPE (klass),
       
    61                   G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
       
    62                   0,
       
    63                   NULL, NULL,
       
    64                   tp_channel_factory_iface_marshal_VOID__OBJECT_POINTER,
       
    65                   G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_POINTER);
       
    66   }
       
    67 }
       
    68 
       
    69 GType
       
    70 tp_channel_factory_iface_get_type (void)
       
    71 {
       
    72 
       
    73 #ifndef EMULATOR
       
    74   static GType type = 0;
       
    75 #endif
       
    76 
       
    77   if (type == 0) {
       
    78     static const GTypeInfo info = {
       
    79       sizeof (TpChannelFactoryIfaceClass),
       
    80       tp_channel_factory_iface_base_init,   /* base_init */
       
    81       NULL,   /* base_finalize */
       
    82       NULL,   /* class_init */
       
    83       NULL,   /* class_finalize */
       
    84       NULL,   /* class_data */
       
    85       0,
       
    86       0,      /* n_preallocs */
       
    87       NULL    /* instance_init */
       
    88     };
       
    89 
       
    90     type = g_type_register_static (G_TYPE_INTERFACE, "TpChannelFactoryIface", &info, 0);
       
    91   }
       
    92 
       
    93   return type;
       
    94 }
       
    95 
       
    96 void
       
    97 tp_channel_factory_iface_close_all (TpChannelFactoryIface *self)
       
    98 {
       
    99   TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->close_all (self);
       
   100 }
       
   101 
       
   102 void
       
   103 tp_channel_factory_iface_connecting (TpChannelFactoryIface *self)
       
   104 {
       
   105   TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->connecting (self);
       
   106 }
       
   107 
       
   108 void
       
   109 tp_channel_factory_iface_connected (TpChannelFactoryIface *self)
       
   110 {
       
   111   TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->connected (self);
       
   112 }
       
   113 
       
   114 void
       
   115 tp_channel_factory_iface_disconnected (TpChannelFactoryIface *self)
       
   116 {
       
   117   TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->disconnected (self);
       
   118 }
       
   119 
       
   120 void
       
   121 tp_channel_factory_iface_foreach (TpChannelFactoryIface *self,
       
   122                                   TpChannelFunc func,
       
   123                                   gpointer data)
       
   124 {
       
   125   TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->foreach (self, func, data);
       
   126 }
       
   127 
       
   128 TpChannelFactoryRequestStatus
       
   129 tp_channel_factory_iface_request (TpChannelFactoryIface *self,
       
   130                                   const gchar *chan_type,
       
   131                                   TpHandleType handle_type,
       
   132                                   guint handle,
       
   133                                   TpChannelIface **ret,
       
   134                                   GError **error)
       
   135 {
       
   136   return (TP_CHANNEL_FACTORY_IFACE_GET_CLASS (self)->request (self, chan_type,
       
   137         handle_type, handle, ret, error));
       
   138 }