static int bookmark_menu_callback(int action, const struct menu_item_ex *this_item) { switch (action) { case ACTION_REQUEST_MENUITEM: if (this_item == &bookmark_load_menu_item) { if (!bookmark_exists()) return ACTION_EXIT_MENUITEM; } /* hide the bookmark menu if there is no playback */ else if ((audio_status() & AUDIO_STATUS_PLAY) == 0) return ACTION_EXIT_MENUITEM; break; #ifdef HAVE_LCD_CHARCELLS case ACTION_ENTER_MENUITEM: status_set_param(true); break; #endif case ACTION_EXIT_MENUITEM: #ifdef HAVE_LCD_CHARCELLS status_set_param(false); #endif settings_save(); break; } return action; }
/* ----------------------------------------------------------------------- */ bool bookmark_autobookmark(bool prompt_ok) { char* bookmark; bool update; if (!bookmark_is_bookmarkable_state()) return false; audio_pause(); /* first pause playback */ update = (global_settings.autoupdatebookmark && bookmark_exists()); bookmark = create_bookmark(); #if CONFIG_CODEC != SWCODEC /* Workaround for inability to speak when paused: all callers will just do audio_stop() when we return, so we can do it right away. This makes it possible to speak the "Create a Bookmark?" prompt and the "Bookmark Created" splash. */ audio_stop(); #endif if (update) return write_bookmark(true, bookmark); switch (global_settings.autocreatebookmark) { case BOOKMARK_YES: return write_bookmark(true, bookmark); case BOOKMARK_NO: return false; case BOOKMARK_RECENT_ONLY_YES: return write_bookmark(false, bookmark); } #ifdef HAVE_LCD_BITMAP const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY)}; const struct text_message message={lines, 1}; #else const char *lines[]={ID2P(LANG_AUTO_BOOKMARK_QUERY), str(LANG_CONFIRM_WITH_BUTTON)}; const struct text_message message={lines, 2}; #endif if(prompt_ok && gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) { if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) return write_bookmark(false, bookmark); else return write_bookmark(true, bookmark); } return false; }
void sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean config_required, const char *const role, const char *const affiliation, const char *const actor, const char *const reason, const char *const jid, const char *const show, const char *const status) { muc_roster_add(room, nick, jid, role, affiliation, show, status); char *old_role = muc_role_str(room); char *old_affiliation = muc_affiliation_str(room); muc_set_role(room, role); muc_set_affiliation(room, affiliation); // handle self nick change if (muc_nick_change_pending(room)) { muc_nick_change_complete(room, nick); ProfMucWin *mucwin = wins_get_muc(room); if (mucwin) { mucwin_nick_change(mucwin, nick); } // handle roster complete } else if (!muc_roster_complete(room)) { if (muc_autojoin(room)) { ui_room_join(room, FALSE); } else { ui_room_join(room, TRUE); } iq_room_info_request(room, FALSE); if (muc_invites_contain(room)) { if (prefs_get_boolean(PREF_BOOKMARK_INVITE) && !bookmark_exists(room)) { bookmark_add(room, nick, muc_invite_password(room), "on"); } muc_invites_remove(room); } muc_roster_set_complete(room); // show roster if occupants list disabled by default ProfMucWin *mucwin = wins_get_muc(room); if (mucwin && !prefs_get_boolean(PREF_OCCUPANTS)) { GList *occupants = muc_roster(room); mucwin_roster(mucwin, occupants, NULL); g_list_free(occupants); } char *subject = muc_subject(room); if (mucwin && subject) { mucwin_subject(mucwin, NULL, subject); } GList *pending_broadcasts = muc_pending_broadcasts(room); if (mucwin && pending_broadcasts) { GList *curr = pending_broadcasts; while (curr) { mucwin_broadcast(mucwin, curr->data); curr = g_list_next(curr); } } // room configuration required if (config_required) { muc_set_requires_config(room, TRUE); if (mucwin) { mucwin_requires_config(mucwin); } } rosterwin_roster(); // check for change in role/affiliation } else { ProfMucWin *mucwin = wins_get_muc(room); if (mucwin && prefs_get_boolean(PREF_MUC_PRIVILEGES)) { // both changed if ((g_strcmp0(role, old_role) != 0) && (g_strcmp0(affiliation, old_affiliation) != 0)) { mucwin_role_and_affiliation_change(mucwin, role, affiliation, actor, reason); // role changed } else if (g_strcmp0(role, old_role) != 0) { mucwin_role_change(mucwin, role, actor, reason); // affiliation changed } else if (g_strcmp0(affiliation, old_affiliation) != 0) { mucwin_affiliation_change(mucwin, affiliation, actor, reason); } } } occupantswin_occupants(room); }