| 1 |
|
| 2 |
|
| 3 |
nc. |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
|
| 21 |
#include "goaidentityinquiry.h" |
| 22 |
#include "goaidentityinquiryprivate.h" |
| 23 |
|
| 24 |
#include <string.h> |
| 25 |
#include <glib/gi18n.h> |
| 26 |
#include <gio/gio.h> |
| 27 |
|
| 28 |
enum |
| 29 |
{ |
| 30 |
COMPLETE, |
| 31 |
NUMBER_OF_SIGNALS, |
| 32 |
}; |
| 33 |
|
| 34 |
static guint signals[NUMBER_OF_SIGNALS] = { 0 }; |
| 35 |
|
| 36 |
G_DEFINE_INTERFACE (GoaIdentityInquiry, goa_identity_inquiry, G_TYPE_OBJECT); |
| 37 |
|
| 38 |
static void |
| 39 |
goa_identity_inquiry_default_init (GoaIdentityInquiryInterface *interface) |
| 40 |
{ |
| 41 |
signals[COMPLETE] = g_signal_new ("complete", |
| 42 |
G_TYPE_FROM_INTERFACE (interface), |
| 43 |
G_SIGNAL_RUN_LAST, |
| 44 |
0, NULL, NULL, NULL, G_TYPE_NONE, 0); |
| 45 |
} |
| 46 |
|
| 47 |
void |
| 48 |
_goa_identity_inquiry_emit_complete (GoaIdentityInquiry *self) |
| 49 |
{ |
| 50 |
g_signal_emit (G_OBJECT (self), signals[COMPLETE], 0); |
| 51 |
} |
| 52 |
|
| 53 |
char * |
| 54 |
goa_identity_inquiry_get_name (GoaIdentityInquiry *self) |
| 55 |
{ |
| 56 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), NULL); |
| 57 |
|
| 58 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->get_name (self); |
| 59 |
} |
| 60 |
|
| 61 |
char * |
| 62 |
goa_identity_inquiry_get_banner (GoaIdentityInquiry *self) |
| 63 |
{ |
| 64 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), NULL); |
| 65 |
|
| 66 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->get_banner (self); |
| 67 |
} |
| 68 |
|
| 69 |
gboolean |
| 70 |
goa_identity_inquiry_is_complete (GoaIdentityInquiry *self) |
| 71 |
{ |
| 72 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), TRUE); |
| 73 |
|
| 74 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->is_complete (self); |
| 75 |
} |
| 76 |
|
| 77 |
gboolean |
| 78 |
goa_identity_inquiry_is_failed (GoaIdentityInquiry *self) |
| 79 |
{ |
| 80 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), TRUE); |
| 81 |
|
| 82 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->is_failed (self); |
| 83 |
} |
| 84 |
|
| 85 |
void |
| 86 |
goa_identity_inquiry_iter_init (GoaIdentityInquiryIter *iter, |
| 87 |
GoaIdentityInquiry *inquiry) |
| 88 |
{ |
| 89 |
g_return_if_fail (GOA_IS_IDENTITY_INQUIRY (inquiry)); |
| 90 |
|
| 91 |
GOA_IDENTITY_INQUIRY_GET_IFACE (inquiry)->iter_init (iter, inquiry); |
| 92 |
} |
| 93 |
|
| 94 |
GoaIdentityQuery * |
| 95 |
goa_identity_inquiry_iter_next (GoaIdentityInquiryIter *iter, |
| 96 |
GoaIdentityInquiry *inquiry) |
| 97 |
{ |
| 98 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (inquiry), NULL); |
| 99 |
|
| 100 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (inquiry)->iter_next (iter, inquiry); |
| 101 |
} |
| 102 |
|
| 103 |
GoaIdentity * |
| 104 |
goa_identity_inquiry_get_identity (GoaIdentityInquiry *self) |
| 105 |
{ |
| 106 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), NULL); |
| 107 |
|
| 108 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->get_identity (self); |
| 109 |
} |
| 110 |
|
| 111 |
GoaIdentityQueryMode |
| 112 |
goa_identity_query_get_mode (GoaIdentityInquiry *self, |
| 113 |
GoaIdentityQuery *query) |
| 114 |
{ |
| 115 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), |
| 116 |
GOA_IDENTITY_QUERY_MODE_INVISIBLE); |
| 117 |
|
| 118 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->get_mode (self, query); |
| 119 |
} |
| 120 |
|
| 121 |
char * |
| 122 |
goa_identity_query_get_prompt (GoaIdentityInquiry *self, |
| 123 |
GoaIdentityQuery *query) |
| 124 |
{ |
| 125 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), NULL); |
| 126 |
|
| 127 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->get_prompt (self, query); |
| 128 |
} |
| 129 |
|
| 130 |
void |
| 131 |
goa_identity_inquiry_answer_query (GoaIdentityInquiry *self, |
| 132 |
GoaIdentityQuery *query, |
| 133 |
const char *answer) |
| 134 |
{ |
| 135 |
g_return_if_fail (GOA_IS_IDENTITY_INQUIRY (self)); |
| 136 |
|
| 137 |
GOA_IDENTITY_INQUIRY_GET_IFACE (self)->answer_query (self, query, answer); |
| 138 |
} |
| 139 |
|
| 140 |
gboolean |
| 141 |
goa_identity_query_is_answered (GoaIdentityInquiry *self, |
| 142 |
GoaIdentityQuery *query) |
| 143 |
{ |
| 144 |
g_return_val_if_fail (GOA_IS_IDENTITY_INQUIRY (self), FALSE); |
| 145 |
|
| 146 |
return GOA_IDENTITY_INQUIRY_GET_IFACE (self)->is_answered (self, query); |
| 147 |
} |