## GtrPo

GtrPo

## Synopsis

    struct              GtrPo;
    struct              GtrPoClass;
    #define             GTR_PO_ERROR
    enum                GtrPoState;
    GQuark              gtr_po_error_quark                  (void);
    GType               gtr_po_register_type                (GTypeModule *module);
    GtrPo *             gtr_po_new                          (void);
    void                gtr_po_parse                        (GtrPo *po,
                                                             GFile *location,
                                                             GError **error);
    void                gtr_po_save_header_in_msg           (GtrPo *po,
                                                             GtrHeader *header);
    void                gtr_po_save_file                    (GtrPo *po,
                                                             GError **error);
    GtrPoState          gtr_po_get_state                    (GtrPo *po);
    void                gtr_po_set_state                    (GtrPo *po,
                                                             GtrPoState state);
    GFile *             gtr_po_get_location                 (GtrPo *po);
    void                gtr_po_set_location                 (GtrPo *po,
                                                             GFile *location);
    gboolean            gtr_po_get_write_perms              (GtrPo *po);
    GList *             gtr_po_get_messages                 (GtrPo *po);
    void                gtr_po_set_messages                 (GtrPo *po,
                                                             GList *messages);
    GList *             gtr_po_get_current_message          (GtrPo *po);
    void                gtr_po_update_current_message       (GtrPo *po,
                                                             GtrMsg *msg);
    GList *             gtr_po_get_domains                  (GtrPo *po);
    po_file_t           gtr_po_get_po_file                  (GtrPo *po);
    GList *             gtr_po_get_next_fuzzy               (GtrPo *po);
    GList *             gtr_po_get_prev_fuzzy               (GtrPo *po);
    GList *             gtr_po_get_next_untrans             (GtrPo *po);
    GList *             gtr_po_get_prev_untrans             (GtrPo *po);
    GList *             gtr_po_get_next_fuzzy_or_untrans    (GtrPo *po);
    GList *             gtr_po_get_prev_fuzzy_or_untrans    (GtrPo *po);
    GList *             gtr_po_get_msg_from_number          (GtrPo *po,
                                                             gint number);
    GtrHeader *         gtr_po_get_header                   (GtrPo *po);
    gint                gtr_po_get_translated_count         (GtrPo *po);
    gint                gtr_po_get_fuzzy_count              (GtrPo *po);
    gint                gtr_po_get_untranslated_count       (GtrPo *po);
    gint                gtr_po_get_messages_count           (GtrPo *po);
    gint                gtr_po_get_message_position         (GtrPo *po);
    gchar *             gtr_po_check_po_file                (GtrPo *po);

## Description

## Details

### struct GtrPo

    struct GtrPo {
      GObject parent_instance;
    };

### struct GtrPoClass

    struct GtrPoClass {
      GObjectClass parent_class;
    };

### GTR_PO_ERROR

    #define GTR_PO_ERROR gtr_po_error_quark()

### enum GtrPoState

    typedef enum {
      GTR_PO_STATE_SAVED,
      GTR_PO_STATE_MODIFIED
    } GtrPoState;

`GTR_PO_STATE_SAVED` |
`GTR_PO_STATE_MODIFIED` |

### gtr_po_error_quark ()

    GQuark              gtr_po_error_quark                  (void);

### gtr_po_register_type ()

    GType               gtr_po_register_type                (GTypeModule *module);

### gtr_po_new ()

    GtrPo *             gtr_po_new                          (void);

Creates a new GtrPo.

Returns : | a new GtrPo object

### gtr_po_parse ()

    void                gtr_po_parse                        (GtrPo *po,
                                                             GFile *location,
                                                             GError **error);

Parses all things related to the GtrPo and initilizes all neccessary variables.

`po` : | a GtrPo
`location` : | the file to open
`error` : | a variable to store the errors

### gtr_po_save_header_in_msg ()

    void                gtr_po_save_header_in_msg           (GtrPo *po,
                                                             GtrHeader *header);

### gtr_po_save_file ()

    void                gtr_po_save_file                    (GtrPo *po,
                                                             GError **error);

It saves the po file and if there are any problem it stores the error in `error`.

`po` : | a GtrPo
`error` : | a GError to manage the exceptions

### gtr_po_get_state ()

    GtrPoState          gtr_po_get_state                    (GtrPo *po);

`po` : | a GtrPo
Returns : | the GtrPoState value of the `po`.

### gtr_po_set_state ()

    void                gtr_po_set_state                    (GtrPo *po,
                                                             GtrPoState state);

Sets the state for a GtrPo

`po` : | a GtrPo
`state` : | a GtrPoState

### gtr_po_get_location ()

    GFile *             gtr_po_get_location                 (GtrPo *po);

Gets the GFile of the po file.

`po` : | a GtrPo
Returns : | the GFile associated with the `po`. The returned location must be freed with g_object_unref. [transfer full]

### gtr_po_set_location ()

    void                gtr_po_set_location                 (GtrPo *po,
                                                             GFile *location);

Sets the GFile location within the GtrPo object.

`po` : | a GtrPo
`location` : | The GFile to set to the GtrPo

### gtr_po_get_write_perms ()

    gboolean            gtr_po_get_write_perms              (GtrPo *po);

### gtr_po_get_messages ()

    GList *             gtr_po_get_messages                 (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the messages list. [transfer container][element-type Gtranslator.Msg]

### gtr_po_set_messages ()

    void                gtr_po_set_messages                 (GtrPo *po,
                                                             GList *messages);

Sets an updated list of messages.

`po` : | a GtrPo
`messages` : | a pointer to a new messages list. [element-type Gtranslator.Msg]

### gtr_po_get_current_message ()

    GList *             gtr_po_get_current_message          (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the current message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_update_current_message ()

    void                gtr_po_update_current_message       (GtrPo *po,
                                                             GtrMsg *msg);

Sets the new current message to the message that is passed in the argument.

`po` : | a GtrPo
`msg` : | the message where should point the current message.

### gtr_po_get_domains ()

    GList *             gtr_po_get_domains                  (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the domains list. [transfer none][element-type utf8]

### gtr_po_get_po_file ()

    po_file_t           gtr_po_get_po_file                  (GtrPo *po);

Gets the gettext file.

`po` : | a GtrPo
Returns : | the gettext file

### gtr_po_get_next_fuzzy ()

    GList *             gtr_po_get_next_fuzzy               (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the next fuzzy message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_prev_fuzzy ()

    GList *             gtr_po_get_prev_fuzzy               (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the previously fuzzy message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_next_untrans ()

    GList *             gtr_po_get_next_untrans             (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the next untranslated message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_prev_untrans ()

    GList *             gtr_po_get_prev_untrans             (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the previously untranslated message or NULL if there are not previously untranslated message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_next_fuzzy_or_untrans ()

    GList *             gtr_po_get_next_fuzzy_or_untrans    (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the next fuzzy or untranslated message or NULL if there is not next fuzzy or untranslated message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_prev_fuzzy_or_untrans ()

    GList *             gtr_po_get_prev_fuzzy_or_untrans    (GtrPo *po);

`po` : | a GtrPo
Returns : | a pointer to the previously fuzzy or untranslated message or NULL if there is not previously fuzzy or untranslated message. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_msg_from_number ()

    GList *             gtr_po_get_msg_from_number          (GtrPo *po,
                                                             gint number);

Gets the message at the given position.

`po` : | a GtrPo
`number` : | the message to jump
Returns : | the message at the given position. [transfer none][element-type Gtranslator.Msg]

### gtr_po_get_header ()

    GtrHeader *         gtr_po_get_header                   (GtrPo *po);

`po` : | a GtrPo
Returns : | The GtrHeader of the `po`. [transfer none]

### gtr_po_get_translated_count ()

    gint                gtr_po_get_translated_count         (GtrPo *po);

`po` : | a GtrPo
Returns : | the count of the translated messages.

### gtr_po_get_fuzzy_count ()

    gint                gtr_po_get_fuzzy_count              (GtrPo *po);

`po` : | a GtrPo
Returns : | the count of the fuzzy messages.

### gtr_po_get_untranslated_count ()

    gint                gtr_po_get_untranslated_count       (GtrPo *po);

`po` : | a GtrPo
Returns : | the count of the untranslated messages.

### gtr_po_get_messages_count ()

    gint                gtr_po_get_messages_count           (GtrPo *po);

`po` : | a GtrPo
Returns : | the number of messages messages.

### gtr_po_get_message_position ()

    gint                gtr_po_get_message_position         (GtrPo *po);

`po` : | a GtrPo
Returns : | the number of the current message.

### gtr_po_check_po_file ()

    gchar *             gtr_po_check_po_file                (GtrPo *po);

Test whether an entire PO file is valid, like msgfmt does it.

`po` : | a GtrPo
Returns : | If it is invalid, returns the error. The return value must be freed with g_free.