Installing property in interface



Hi!

I'm trying to install property into main interface, but when I run program
it always display me this warning:

(lt-goofysender:10709): GLib-GObject-WARNING **: When installing property:
type `GoofyFileTransfer' already has a property named `transfer-status'

Here you have some code:


//>>>
/*>>> Interface definition <<<*/
//>>>

GType   goofy_file_transfer_get_type (void) {
   static GType type = G_TYPE_INVALID;

   if (type == G_TYPE_INVALID) {
       static const GTypeInfo info = {
           sizeof (GoofyFileTransferIface),    /* class_size */
           goofy_file_transfer_base_init,    /* base_init */
           NULL,            /* base_finalize */
           NULL,
           NULL,            /* class_finalize */
           NULL,            /* class_data */
           0,
           0,            /* n_preallocs */
           NULL
       };
       type = g_type_register_static (G_TYPE_INTERFACE,
"GoofyFileTransfer", &info, 0);
   }

   return type;
}

/* cut */

static void goofy_file_transfer_base_init (gpointer g_iface) {
   g_object_interface_install_property (g_iface,
                      g_param_spec_int ("transfer-status",
                                "Transfer status",
                                "Specify current transfer status",
                                0,
  100,
  1,
                                G_PARAM_READWRITE));
}
//>>>
/*>>> Class, which implement this interface <<<*/
//>>>
static void     goofy_file_transfer_iface_init (gpointer       g_iface,
                                               gpointer       iface_data);

G_DEFINE_TYPE_WITH_CODE (GoofySendFile, goofy_send_file, GOOFY_TYPE_FILE,
                         G_IMPLEMENT_INTERFACE (GOOFY_TYPE_FILE_TRANSFER,

goofy_file_transfer_iface_init))
/* cut */

static void goofy_send_file_class_init (GoofySendFileClass  *klass)    {
   GObjectClass        *g_klass = G_OBJECT_CLASS (klass);
   GoofySendFileClass  *send_file_class = GOOFY_SEND_FILE_CLASS (klass);

   g_klass->set_property = goofy_send_file_set_property;
   g_klass->get_property = goofy_send_file_get_property;
   g_klass->dispose = goofy_send_file_dispose;
   g_klass->finalize = goofy_send_file_finalize;

   /* Sent data size */
   g_object_class_install_property (g_klass, PROP_SENT_SIZE,
       g_param_spec_uint ("sent-size",
           "Sent sizer",
           "Total amount of file's bytes, which were send.",
           1,
           G_MAXUINT,
           1,
           G_PARAM_READABLE));

    /* Install interface's properties */
    g_object_class_override_property (g_klass, PROP_TRANSFER_STATUS,
"transfer-status");

    /* Install signals */
    send_file_class->file_send_step = g_signal_new ("file-send-setp",
                G_TYPE_FROM_CLASS (g_klass),
                G_SIGNAL_RUN_LAST,
                0,
                NULL,
                NULL,
                g_cclosure_marshal_VOID__VOID,
                G_TYPE_NONE,
                0);



static void     goofy_file_transfer_iface_init (gpointer       g_iface,
                                               gpointer       iface_data)
{
   GoofyFileTransferIface   *iface = g_iface;

   iface->transfer_start = goofy_send_file_start;
   iface->transfer_cancel = goofy_send_file_cancel;
}


Can you tell me why this warning occur in my code?

--
Cya!
Tom



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