RtcomWidget

RtcomWidget — interface for all widgets bound to some account setting.

Synopsis




            RtcomWidgetIface;
            RtcomWidget;
#define     RTCOM_DEFINE_WIDGET_TYPE        (TN, t_n, T_P)
void        rtcom_widget_instance_init      (RtcomWidget *widget);
void        rtcom_widget_class_init         (GObjectClass *object_class);
void        rtcom_widget_set_account        (RtcomWidget *widget,
                                             RtcomAccountItem *account);
RtcomAccountItem* rtcom_widget_get_account  (RtcomWidget *widget);
void        rtcom_widget_set_msg_next       (RtcomWidget *widget,
                                             const gchar *message);
const gchar* rtcom_widget_get_msg_next      (RtcomWidget *widget);
void        rtcom_widget_set_error_widget   (RtcomWidget *widget,
                                             GtkWidget *error_widget);
void        rtcom_widget_focus_error        (RtcomWidget *widget);
gboolean    rtcom_widget_validate           (RtcomWidget *widget,
                                             GError **error);
gboolean    rtcom_widget_get_value          (RtcomWidget *widget,
                                             GValue *value);
void        rtcom_widget_value_changed      (RtcomWidget *widget);

Object Hierarchy


  GInterface
   +----RtcomWidget

Description

This interface is to be implemented by all UI widgets that meet any of these needs:

  • the widget has a setting to store into the McAccount
  • the widget is able to block the user from proceeding to the next page

Since this interface includes some hacks to support interface data, it's recommended that you declare your widgets by the RTCOM_DEFINE_WIDGET_TYPE() macro.

Details

RtcomWidgetIface

typedef struct {
    GTypeInterface g_iface;

    /* methods */
    gboolean (* store_settings) (RtcomWidget *rtcom_widget, GError **error,
                                 RtcomAccountItem  *item);
    void (* get_settings) (RtcomWidget *rtcom_widget, RtcomAccountItem  *item);
    void (* set_account) (RtcomWidget *widget, RtcomAccountItem *account);
    gboolean (* validate) (RtcomWidget *widget, GError **error);
    gboolean (* get_value) (RtcomWidget *widget, GValue *value);
} RtcomWidgetIface;


RtcomWidget

typedef struct _RtcomWidget RtcomWidget;


RTCOM_DEFINE_WIDGET_TYPE()

#define     RTCOM_DEFINE_WIDGET_TYPE(TN, t_n, T_P)

TN :
t_n :
T_P :

rtcom_widget_instance_init ()

void        rtcom_widget_instance_init      (RtcomWidget *widget);

Call this function from the _init() method of the widgets implementing this interface (the RTCOM_DEFINE_WIDGET_TYPE() macro does this for you).

widget :

rtcom_widget_class_init ()

void        rtcom_widget_class_init         (GObjectClass *object_class);

Call this function at the end of the _class_init() of the widgets implementing this interface (the RTCOM_DEFINE_WIDGET_TYPE() macro does this for you).

object_class : the GObjectClass being initialized.

rtcom_widget_set_account ()

void        rtcom_widget_set_account        (RtcomWidget *widget,
                                             RtcomAccountItem *account);

Associates widgets with account.

widget : the RtcomWidget.
account : a RtcomAccountItem.

rtcom_widget_get_account ()

RtcomAccountItem* rtcom_widget_get_account  (RtcomWidget *widget);

widget : the RtcomWidget.
Returns : the RtcomAccountItem bound to widget.

rtcom_widget_set_msg_next ()

void        rtcom_widget_set_msg_next       (RtcomWidget *widget,
                                             const gchar *message);

Sets the message to be displayed if the wizard's Next button is pressed while widget has its "can-next" property set to FALSE.

widget : the RtcomWidget.
message : the message.

rtcom_widget_get_msg_next ()

const gchar* rtcom_widget_get_msg_next      (RtcomWidget *widget);

widget : the RtcomWidget.
Returns : the error-on-next message.

rtcom_widget_set_error_widget ()

void        rtcom_widget_set_error_widget   (RtcomWidget *widget,
                                             GtkWidget *error_widget);

For composite RtcomWidgets, determine which is the GtkWidget that is causing the "can-next" propery to be FALSE. This is using to set some error indicator on the widget (typically, move the focus to it).

widget : the RtcomWidget.
error_widget : a GtkWidget.

rtcom_widget_focus_error ()

void        rtcom_widget_focus_error        (RtcomWidget *widget);

Set some error indicator on the widget. In the current implementation, this function should set the focus to the widget.

widget : the RtcomWidget.

rtcom_widget_validate ()

gboolean    rtcom_widget_validate           (RtcomWidget *widget,
                                             GError **error);

Asks the widget to validate itself. The function will return TRUE if validation succeeded, otherwise it will return FALSE and set error. In the latter case, the widget can also request the focus back to itself.

widget : the RtcomWidget.
error : pointer to a GError variable to receive an error.
Returns : TRUE on success, FALSE otherwise.

rtcom_widget_get_value ()

gboolean    rtcom_widget_get_value          (RtcomWidget *widget,
                                             GValue *value);

Retrieve the value of widget into value. If value is unset, the widget will initialize it to the type most suitable for the widget data; otherwise, it will try to return the value of the requested type.

widget : the RtcomWidget.
value : a GValue, either unset or initialized with a type supported by the widget.
Returns : TRUE on success, FALSE otherwise.

rtcom_widget_value_changed ()

void        rtcom_widget_value_changed      (RtcomWidget *widget);

Implementations call this method to signal their value has changed.

widget : the RtcomWidget.