| 318 } |
320 } |
| 319 |
321 |
| 320 /************************************************************************** |
322 /************************************************************************** |
| 321 * GObject code for PurplePresence |
323 * GObject code for PurplePresence |
| 322 **************************************************************************/ |
324 **************************************************************************/ |
| 323 |
|
| 324 /* GObject Property names */ |
|
| 325 #define PRES_PROP_IDLE_S "idle" |
|
| 326 #define PRES_PROP_IDLE_TIME_S "idle-time" |
|
| 327 #define PRES_PROP_LOGIN_TIME_S "login-time" |
|
| 328 #define PRES_PROP_STATUSES_S "statuses" |
|
| 329 #define PRES_PROP_ACTIVE_STATUS_S "active-status" |
|
| 330 |
325 |
| 331 /* Set method for GObject properties */ |
326 /* Set method for GObject properties */ |
| 332 static void |
327 static void |
| 333 purple_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
328 purple_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
| 334 GParamSpec *pspec) |
329 GParamSpec *pspec) |
| 460 /* Setup properties */ |
455 /* Setup properties */ |
| 461 obj_class->get_property = purple_presence_get_property; |
456 obj_class->get_property = purple_presence_get_property; |
| 462 obj_class->set_property = purple_presence_set_property; |
457 obj_class->set_property = purple_presence_set_property; |
| 463 |
458 |
| 464 g_object_class_install_property(obj_class, PRES_PROP_IDLE, |
459 g_object_class_install_property(obj_class, PRES_PROP_IDLE, |
| 465 g_param_spec_boolean(PRES_PROP_IDLE_S, _("Idle"), |
460 g_param_spec_boolean("idle", _("Idle"), |
| 466 _("Whether the presence is in idle state."), FALSE, |
461 _("Whether the presence is in idle state."), FALSE, |
| 467 G_PARAM_READWRITE) |
462 G_PARAM_READWRITE) |
| 468 ); |
463 ); |
| 469 |
464 |
| 470 |
465 |
| 474 #elif SIZEOF_TIME_T == 8 |
469 #elif SIZEOF_TIME_T == 8 |
| 475 g_param_spec_int64 |
470 g_param_spec_int64 |
| 476 #else |
471 #else |
| 477 #error Unknown size of time_t |
472 #error Unknown size of time_t |
| 478 #endif |
473 #endif |
| 479 (PRES_PROP_IDLE_TIME_S, _("Idle time"), |
474 ("idle-time", _("Idle time"), |
| 480 _("The idle time of the presence"), |
475 _("The idle time of the presence"), |
| 481 #if SIZEOF_TIME_T == 4 |
476 #if SIZEOF_TIME_T == 4 |
| 482 G_MININT, G_MAXINT, 0, |
477 G_MININT, G_MAXINT, 0, |
| 483 #elif SIZEOF_TIME_T == 8 |
478 #elif SIZEOF_TIME_T == 8 |
| 484 G_MININT64, G_MAXINT64, 0, |
479 G_MININT64, G_MAXINT64, 0, |
| 494 #elif SIZEOF_TIME_T == 8 |
489 #elif SIZEOF_TIME_T == 8 |
| 495 g_param_spec_int64 |
490 g_param_spec_int64 |
| 496 #else |
491 #else |
| 497 #error Unknown size of time_t |
492 #error Unknown size of time_t |
| 498 #endif |
493 #endif |
| 499 (PRES_PROP_LOGIN_TIME_S, _("Login time"), |
494 ("login-time", _("Login time"), |
| 500 _("The login time of the presence."), |
495 _("The login time of the presence."), |
| 501 #if SIZEOF_TIME_T == 4 |
496 #if SIZEOF_TIME_T == 4 |
| 502 G_MININT, G_MAXINT, 0, |
497 G_MININT, G_MAXINT, 0, |
| 503 #elif SIZEOF_TIME_T == 8 |
498 #elif SIZEOF_TIME_T == 8 |
| 504 G_MININT64, G_MAXINT64, 0, |
499 G_MININT64, G_MAXINT64, 0, |
| 507 #endif |
502 #endif |
| 508 G_PARAM_READWRITE) |
503 G_PARAM_READWRITE) |
| 509 ); |
504 ); |
| 510 |
505 |
| 511 g_object_class_install_property(obj_class, PRES_PROP_STATUSES, |
506 g_object_class_install_property(obj_class, PRES_PROP_STATUSES, |
| 512 g_param_spec_pointer(PRES_PROP_STATUSES_S, _("Statuses"), |
507 g_param_spec_pointer("statuses", _("Statuses"), |
| 513 _("The list of statuses in the presence."), |
508 _("The list of statuses in the presence."), |
| 514 G_PARAM_READABLE) |
509 G_PARAM_READABLE) |
| 515 ); |
510 ); |
| 516 |
511 |
| 517 g_object_class_install_property(obj_class, PRES_PROP_ACTIVE_STATUS, |
512 g_object_class_install_property(obj_class, PRES_PROP_ACTIVE_STATUS, |
| 518 g_param_spec_object(PRES_PROP_ACTIVE_STATUS_S, _("Active status"), |
513 g_param_spec_object("active-status", _("Active status"), |
| 519 _("The active status for the presence."), PURPLE_TYPE_STATUS, |
514 _("The active status for the presence."), PURPLE_TYPE_STATUS, |
| 520 G_PARAM_READWRITE) |
515 G_PARAM_READWRITE) |
| 521 ); |
516 ); |
| 522 |
517 |
| 523 g_type_class_add_private(klass, sizeof(PurplePresencePrivate)); |
518 g_type_class_add_private(klass, sizeof(PurplePresencePrivate)); |
| 682 |
677 |
| 683 /************************************************************************** |
678 /************************************************************************** |
| 684 * GObject code for PurpleAccountPresence |
679 * GObject code for PurpleAccountPresence |
| 685 **************************************************************************/ |
680 **************************************************************************/ |
| 686 |
681 |
| 687 /* GObject Property names */ |
|
| 688 #define ACPRES_PROP_ACCOUNT_S "account" |
|
| 689 |
|
| 690 /* Set method for GObject properties */ |
682 /* Set method for GObject properties */ |
| 691 static void |
683 static void |
| 692 purple_account_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
684 purple_account_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
| 693 GParamSpec *pspec) |
685 GParamSpec *pspec) |
| 694 { |
686 { |
| 751 /* Setup properties */ |
743 /* Setup properties */ |
| 752 obj_class->get_property = purple_account_presence_get_property; |
744 obj_class->get_property = purple_account_presence_get_property; |
| 753 obj_class->set_property = purple_account_presence_set_property; |
745 obj_class->set_property = purple_account_presence_set_property; |
| 754 |
746 |
| 755 g_object_class_install_property(obj_class, ACPRES_PROP_ACCOUNT, |
747 g_object_class_install_property(obj_class, ACPRES_PROP_ACCOUNT, |
| 756 g_param_spec_object(ACPRES_PROP_ACCOUNT_S, _("Account"), |
748 g_param_spec_object("account", _("Account"), |
| 757 _("The account that this presence is of."), PURPLE_TYPE_ACCOUNT, |
749 _("The account that this presence is of."), PURPLE_TYPE_ACCOUNT, |
| 758 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
750 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
| 759 ); |
751 ); |
| 760 |
752 |
| 761 g_type_class_add_private(klass, sizeof(PurpleAccountPresencePrivate)); |
753 g_type_class_add_private(klass, sizeof(PurpleAccountPresencePrivate)); |
| 792 purple_account_presence_new(PurpleAccount *account) |
784 purple_account_presence_new(PurpleAccount *account) |
| 793 { |
785 { |
| 794 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
786 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
| 795 |
787 |
| 796 return g_object_new(PURPLE_TYPE_ACCOUNT_PRESENCE, |
788 return g_object_new(PURPLE_TYPE_ACCOUNT_PRESENCE, |
| 797 ACPRES_PROP_ACCOUNT_S, account, |
789 "account", account, |
| 798 NULL); |
790 NULL); |
| 799 } |
791 } |
| 800 |
792 |
| 801 /************************************************************************** |
793 /************************************************************************** |
| 802 * PurpleBuddyPresence API |
794 * PurpleBuddyPresence API |
| 877 |
869 |
| 878 /************************************************************************** |
870 /************************************************************************** |
| 879 * GObject code for PurpleBuddyPresence |
871 * GObject code for PurpleBuddyPresence |
| 880 **************************************************************************/ |
872 **************************************************************************/ |
| 881 |
873 |
| 882 /* GObject Property names */ |
|
| 883 #define BUDPRES_PROP_BUDDY_S "buddy" |
|
| 884 |
|
| 885 /* Set method for GObject properties */ |
874 /* Set method for GObject properties */ |
| 886 static void |
875 static void |
| 887 purple_buddy_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
876 purple_buddy_presence_set_property(GObject *obj, guint param_id, const GValue *value, |
| 888 GParamSpec *pspec) |
877 GParamSpec *pspec) |
| 889 { |
878 { |
| 948 /* Setup properties */ |
937 /* Setup properties */ |
| 949 obj_class->get_property = purple_buddy_presence_get_property; |
938 obj_class->get_property = purple_buddy_presence_get_property; |
| 950 obj_class->set_property = purple_buddy_presence_set_property; |
939 obj_class->set_property = purple_buddy_presence_set_property; |
| 951 |
940 |
| 952 g_object_class_install_property(obj_class, BUDPRES_PROP_BUDDY, |
941 g_object_class_install_property(obj_class, BUDPRES_PROP_BUDDY, |
| 953 g_param_spec_object(BUDPRES_PROP_BUDDY_S, _("Buddy"), |
942 g_param_spec_object("buddy", _("Buddy"), |
| 954 _("The buddy that this presence is of."), PURPLE_TYPE_BUDDY, |
943 _("The buddy that this presence is of."), PURPLE_TYPE_BUDDY, |
| 955 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
944 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY) |
| 956 ); |
945 ); |
| 957 |
946 |
| 958 g_type_class_add_private(klass, sizeof(PurpleBuddyPresencePrivate)); |
947 g_type_class_add_private(klass, sizeof(PurpleBuddyPresencePrivate)); |
| 989 purple_buddy_presence_new(PurpleBuddy *buddy) |
978 purple_buddy_presence_new(PurpleBuddy *buddy) |
| 990 { |
979 { |
| 991 g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
980 g_return_val_if_fail(PURPLE_IS_BUDDY(buddy), NULL); |
| 992 |
981 |
| 993 return g_object_new(PURPLE_TYPE_BUDDY_PRESENCE, |
982 return g_object_new(PURPLE_TYPE_BUDDY_PRESENCE, |
| 994 BUDPRES_PROP_BUDDY_S, buddy, |
983 "buddy", buddy, |
| 995 NULL); |
984 NULL); |
| 996 } |
985 } |