RAbook

RAbook —

Synopsis




#define     R_ABOOK_TYPE
#define     R_ABOOK                         (obj)
#define     R_ABOOK_CLASS                   (klass)
#define     IS_R_ABOOK                      (obj)
#define     IS_R_ABOOK_CLASS                (klass)
#define     R_ABOOK_GET_CLASS               (klass)
            RAbookPrivate;
            RAbook;
GType       r_abook_get_type                (void);
RAbook*     r_abook_new                     (void);
void        r_abook_free                    (RAbook *abook);
gboolean    r_abook_open_file               (RAbook *abook,
                                             gchar *fname);
gboolean    r_abook_save_file               (RAbook *abook,
                                             gchar *fname,
                                             gint compression_rate);
gboolean    r_abook_overwrite_file          (RAbook *abook,
                                             gboolean backup,
                                             gint compression_rate);
RAbook*     r_abook_copy                    (RAbook *abook);
gboolean    r_abook_load_plugin             (RAbook *abook,
                                             const gchar *name);
gpointer    r_abook_get_plugin              (RAbook *abook);
gint        r_abook_get_items               (RAbook *abook);
void        r_abook_add_card                (RAbook *abook,
                                             RCard *card);
void        r_abook_replace_card            (RAbook *abook,
                                             RCard *old,
                                             RCard *new);
gpointer    r_abook_get_card_by_id          (RAbook *abook,
                                             glong id);
gpointer    r_abook_get_selected_card       (RAbook *abook);
void        r_abook_foreach_card            (RAbook *abook,
                                             RFunc func,
                                             gpointer data);
gpointer    r_abook_get_card                (RAbook *abook);
gpointer    r_abook_get_next_card           (RAbook *abook);
gpointer    r_abook_get_prev_card           (RAbook *abook);
void        r_abook_reset_book              (RAbook *abook);
GList*      r_abook_find_cards_in_group     (RAbook *abook,
                                             gchar *group_name);

Object Hierarchy


  GObject
   +----RAbook

Properties


  "addressbook-name"     gchararray            : Read / Write / Construct
  "addressbook-path"     gchararray            : Read / Write / Construct
  "deleted-cards"        gint                  : Read
  "selected-id"          glong                 : Read / Write / Construct

Signals


"addressbook-changed"
            void        user_function      (RAbook  *rabook,
                                            gpointer user_data)      : Run last
"addressbook-closed"
            void        user_function      (RAbook  *rabook,
                                            gpointer user_data)      : Run last
"addressbook-read"
            void        user_function      (RAbook  *abook,
                                            gpointer user_data)      : Run last
"addressbook-saved"
            void        user_function      (RAbook  *rabook,
                                            gpointer user_data)      : Run last
"card-added"
            void        user_function      (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last
"card-cutted"
            void        user_function      (RAbook  *arg0,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last
"card-destroyed"
            void        user_function      (RAbook  *abook,
                                            gpointer user_data)      : Run last
"card-read" void        user_function      (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last
"card-recovered"
            void        user_function      (RAbook  *rabook,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last
"card-removed"
            void        user_function      (RAbook  *abook,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last
"card-replaced"
            void        user_function      (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last
"open-fail" void        user_function      (RAbook  *abook,
                                            gint     err,
                                            gpointer user_data)      : Run last
"save-fail" void        user_function      (RAbook  *abook,
                                            gint     err,
                                            gpointer user_data)      : Run last

Description

Details

R_ABOOK_TYPE

#define R_ABOOK_TYPE             (r_abook_get_type())


R_ABOOK()

#define     R_ABOOK(obj)

obj :

R_ABOOK_CLASS()

#define     R_ABOOK_CLASS(klass)

klass :

IS_R_ABOOK()

#define     IS_R_ABOOK(obj)

obj :

IS_R_ABOOK_CLASS()

#define     IS_R_ABOOK_CLASS(klass)

klass :

R_ABOOK_GET_CLASS()

#define     R_ABOOK_GET_CLASS(klass)

klass :

RAbookPrivate

typedef struct _RAbookPrivate RAbookPrivate;


RAbook

typedef struct _RAbook RAbook;


r_abook_get_type ()

GType       r_abook_get_type                (void);

Returns :

r_abook_new ()

RAbook*     r_abook_new                     (void);

create a RAbook

Returns : a new RAbook

r_abook_free ()

void        r_abook_free                    (RAbook *abook);

free the RAbook The "addressbook_closed" signal is emitted

abook : a RAbook

r_abook_open_file ()

gboolean    r_abook_open_file               (RAbook *abook,
                                             gchar *fname);

open the addressbook with given name

abook : a RAbook
fname : the name of the addressbook
Returns : TRUE if file is opened successfully, FALSE otherwise

r_abook_save_file ()

gboolean    r_abook_save_file               (RAbook *abook,
                                             gchar *fname,
                                             gint compression_rate);

save the addressbook with given filename

abook : a RAbook
fname : the name of file
compression_rate :
Returns : TRUE if file is saved successfully, FALSE otherwise

r_abook_overwrite_file ()

gboolean    r_abook_overwrite_file          (RAbook *abook,
                                             gboolean backup,
                                             gint compression_rate);

overwrite an existing addressbook with a new one. If backup is TRUE the old addressbook is backuped.

abook : a RAbook
backup : boolean
compression_rate :
Returns : a TRUE if old addressbook was successfully overwited, FALSE otherwise

r_abook_copy ()

RAbook*     r_abook_copy                    (RAbook *abook);

copy the addressbook pointed by abook

abook : a RAbook
Returns : a new RAbook

r_abook_load_plugin ()

gboolean    r_abook_load_plugin             (RAbook *abook,
                                             const gchar *name);

Load the "plugin_name" plugin.

abook : a RAbook
name :
Returns : TRUE if plugin is loaded, FALSE otherwise

r_abook_get_plugin ()

gpointer    r_abook_get_plugin              (RAbook *abook);

Get the currently active plugin

abook : a RAbook
Returns : a gpointer to the plugin

r_abook_get_items ()

gint        r_abook_get_items               (RAbook *abook);

get the number of cards into addressbok

abook : a RAbook
Returns : an integer

r_abook_add_card ()

void        r_abook_add_card                (RAbook *abook,
                                             RCard *card);

append the given card into the addressbook The "card_added" and "addressbook_changed" signals are emitted

abook : a RAbook
card : an RCard object

r_abook_replace_card ()

void        r_abook_replace_card            (RAbook *abook,
                                             RCard *old,
                                             RCard *new);

replace the old card with the new one The "card_replaced" and "addressbook_changed" signals are emitted

abook : a RAbook
old : an RCard object
new : an RCard object

r_abook_get_card_by_id ()

gpointer    r_abook_get_card_by_id          (RAbook *abook,
                                             glong id);

get the card with "id" id

abook : a RAbook
id : the card id
Returns : a pointer to the card or NULL if addressbook doesn't own that card

r_abook_get_selected_card ()

gpointer    r_abook_get_selected_card       (RAbook *abook);

Get the selected card in the addressbook

abook : a RAbook
Returns :

r_abook_foreach_card ()

void        r_abook_foreach_card            (RAbook *abook,
                                             RFunc func,
                                             gpointer data);

Call the function func() for each card in the RAbook.

abook : a RAbook
func : the RFunc that will be called for each card in addressbook
data : user's data to pass to func

r_abook_get_card ()

gpointer    r_abook_get_card                (RAbook *abook);

Get the first card in addressbook.

abook : a RAbook
Returns : a pointer to the card or NULL if addressbook is empty

r_abook_get_next_card ()

gpointer    r_abook_get_next_card           (RAbook *abook);

get the next card in addressbook

abook : a RAbook
Returns : a pointer to the card or NULL if the cards's end list is reached.

r_abook_get_prev_card ()

gpointer    r_abook_get_prev_card           (RAbook *abook);

get the previous card in addressbook

abook : a RAbook
Returns : a pointer to the card or NULL if the cards's head list is reached.

r_abook_reset_book ()

void        r_abook_reset_book              (RAbook *abook);

reset the private addressbook iterator. The iterator will point the head of cards's list.

abook : a RAbook

r_abook_find_cards_in_group ()

GList*      r_abook_find_cards_in_group     (RAbook *abook,
                                             gchar *group_name);

Find all cards that belongs to the given group. Found cards's ID has inserted in a GList. Caller must free returned GList

abook : a RAbook
group_name : the name of the group
Returns : a GList* or NULL if no cards belong to group

Property Details

The "addressbook-name" property

  "addressbook-name"     gchararray            : Read / Write / Construct

the name (filename) of the addressbook.

Default value: "no name"


The "addressbook-path" property

  "addressbook-path"     gchararray            : Read / Write / Construct

the path of the addressbook.

Default value: NULL


The "deleted-cards" property

  "deleted-cards"        gint                  : Read

number of cards marked as deleted in the addressbook.

Default value: 0


The "selected-id" property

  "selected-id"          glong                 : Read / Write / Construct

load/save the id of the selected card.

Default value: 0

Signal Details

The "addressbook-changed" signal

void        user_function                  (RAbook  *rabook,
                                            gpointer user_data)      : Run last

rabook : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "addressbook-closed" signal

void        user_function                  (RAbook  *rabook,
                                            gpointer user_data)      : Run last

rabook : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "addressbook-read" signal

void        user_function                  (RAbook  *abook,
                                            gpointer user_data)      : Run last

The "addressbook-read" signal is emitted when the addressbook is read

abook : the RAbook object that receives the signal
user_data : user data set when the signal handler was connected.

The "addressbook-saved" signal

void        user_function                  (RAbook  *rabook,
                                            gpointer user_data)      : Run last

rabook : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "card-added" signal

void        user_function                  (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last

The "card-added" signal is emitted after a card is added to addressbook. A pointer to the card is passed to the callback function

abook : the RAbook object that receives the signal
data : a pointer to the readed card
user_data : user data set when the signal handler was connected.

The "card-cutted" signal

void        user_function                  (RAbook  *arg0,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last

user_data : user data set when the signal handler was connected.

The "card-destroyed" signal

void        user_function                  (RAbook  *abook,
                                            gpointer user_data)      : Run last

The "card-destroyed" signal is emitted when a card is deleted from addressbook. Destroyed cards are unrecoverable.

abook : the RAbook object that receives the signal
user_data : user data set when the signal handler was connected.

The "card-read" signal

void        user_function                  (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last

The "card-read" signal is emitted after the addressbook has been readed

abook : the RAbook object that receives the signal
data : a pointer to the readed card
user_data : user data set when the signal handler was connected.

The "card-recovered" signal

void        user_function                  (RAbook  *rabook,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last

rabook : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "card-removed" signal

void        user_function                  (RAbook  *abook,
                                            gpointer arg1,
                                            gpointer user_data)      : Run last

The "card-removed" signal is emitted when a card is (deleted) removed from addressbook. The removed cards are marked as deleted, to really delete (remove) the card you must destroy it. You can recover (deleted) removed cards. Destroyed cards are unrecoverable

abook : the RAbook object that receives the signal
user_data : user data set when the signal handler was connected.

The "card-replaced" signal

void        user_function                  (RAbook  *abook,
                                            gpointer data,
                                            gpointer user_data)      : Run last

The "card-replaced" signal is emitted a card replacement. A pointer to the new card is passed to the callback function

abook : the RAbook object that receives the signal
data : a pointer to the readed card
user_data : user data set when the signal handler was connected.

The "open-fail" signal

void        user_function                  (RAbook  *abook,
                                            gint     err,
                                            gpointer user_data)      : Run last

the "open-fail" signal is emitted if the given file can't be read

abook : the RAbook object that receives the signal
err : an RError
user_data : user data set when the signal handler was connected.

The "save-fail" signal

void        user_function                  (RAbook  *abook,
                                            gint     err,
                                            gpointer user_data)      : Run last

the "save-fail" signal is emitted if the given file can't be read

abook : the RAbook object that receives the signal
err : an RError
user_data : user data set when the signal handler was connected.