25 #define AWAR_ADVICE_TMP "/tmp/advices/"
27 #define AWAR_ADVICE_TEXT AWAR_ADVICE_TMP "text"
28 #define AWAR_ADVICE_UNDERSTOOD AWAR_ADVICE_TMP "understood"
30 #define AWAR_ADVICE_DISABLED "/advices/disabled"
31 #define AWAR_ADVICE_SHOWN "/tmp/advices/shown"
60 return found ? found-idlist : -1;
79 newList = strdup(idlist+strlen(
id)+1);
82 newList = strdup(idlist);
83 char *idPos = newList+
offset;
84 strcpy(idPos, idPos+strlen(
id)+1);
120 static bool in_advice =
false;
123 AW_advice(
"You have disabled an advice.\n"
124 "In order to disable it PERMANENTLY, save properties.", AW_ADVICE_TOGGLE,
"Advice disabled",
"advice.hlp");
142 int entries = strlen(disabled)-strlen(nosemi);
143 const char *msg =
"No advices were disabled yet.";
149 "To reactivate them for future sessions, save properties.",
162 size_t message_len = strlen(message);
aw_assert(message_len>0);
163 long crc32 =
GB_checksum(message, message_len,
true,
" .,-!");
173 #if defined(ASSERTION_USED)
175 #endif // ASSERTION_USED
177 AW_window_simple *aws =
new AW_window_simple;
179 if (!title) title =
"Please read carefully";
181 aws->load_xfig(
"window/advice.fig");
184 bool help_pops_up =
false;
189 aws->create_button(
NULp,
"HELP",
"H");
205 aws->label(
"Do not advice me again");
206 aws->at(
"understood");
211 if (type & AW_ADVICE_TOGGLE) {
213 aws->create_button(
NULp,
"OK",
"O");
217 aws->create_autosize_button(
NULp,
"I understand",
"O", 2);
221 aws->allow_delete_window(
false);
232 void TEST_advice_id_awar_handling() {
234 AW_root root(
"min_ascii.arb", UNITTEST_MOCK);
237 const char *one =
"one";
238 const char *two =
"second";
272 void TEST_another_AW_root() {
274 AW_root(
"min_ascii.arb", UNITTEST_MOCK);
void toggle_advice_shown(const char *id)
int advice_id_offset(const char *id, const char *idlist)
bool advice_disabled(const char *id)
void init_Advisor(AW_root *awr)
has to be called one time (before calling AW_advice)
void remove_advice_id(const char *id, AW_awar *var)
void AW_reactivate_all_advices(AW_window *)
reactivates all advices which were disabled by the user
#define AWAR_ADVICE_UNDERSTOOD
const char * GBS_global_string(const char *templat,...)
void AW_advice(const char *message, AW_Advice_Type type, const char *title, const char *corresponding_help)
Show a message box with an advice for the user.
char * GBS_string_eval(const char *insource, const char *icommand)
uint32_t GB_checksum(const char *seq, long length, int ignore_case, const char *exclude)
bool advice_id_is_set(const char *id, const char *idlist)
static AW_root * advice_root
#define TEST_PUBLISH(testfunction)
const char * read_char_pntr() const
WindowCallback makeHelpCallback(const char *helpfile)
#define TEST_EXPECT(cond)
bool advice_currently_shown(const char *id)
#define AWAR_ADVICE_SHOWN
void message(char *errortext)
#define TEST_REJECT(cond)
void toggle_advice_id(const char *id, AW_awar *var)
char * read_string() const
AW_awar * awar(const char *awar)
static void advice_hide_and_close_cb(AW_window *aww, const char *id, AW_Advice_Type type)
#define AWAR_ADVICE_DISABLED
AW_Advice_Type
define type of AW_advice by or-ing values
void disable_advice(const char *id)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
void set_advice_id(const char *id, AW_awar *var)
AW_awar * get_disabled_advices()
void aw_message(const char *msg)
void AW_help_popup(UNFIXED, const char *help_file)
GB_ERROR write_string(const char *aw_string)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
static void advice_close_cb(AW_window *aww, const char *id, AW_Advice_Type type)
GB_ERROR write_int(long aw_int)
AW_awar * get_shown_advices()
char * GBS_global_string_copy(const char *templat,...)