1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Moved preferences display functions to console module

This commit is contained in:
James Booth 2013-04-21 01:25:10 +01:00
parent 6253897ea7
commit b3ed4dd0fe
2 changed files with 243 additions and 213 deletions

View File

@ -778,6 +778,249 @@ cons_show_account(ProfAccount *account)
} }
} }
void
cons_show_ui_prefs(void)
{
cons_show("UI preferences:");
cons_show("");
gchar *theme = prefs_get_string(PREF_THEME);
if (theme == NULL) {
cons_show("Theme (/theme) : default");
} else {
cons_show("Theme (/theme) : %s", theme);
}
if (prefs_get_boolean(PREF_BEEP))
cons_show("Terminal beep (/beep) : ON");
else
cons_show("Terminal beep (/beep) : OFF");
if (prefs_get_boolean(PREF_FLASH))
cons_show("Terminal flash (/flash) : ON");
else
cons_show("Terminal flash (/flash) : OFF");
if (prefs_get_boolean(PREF_INTYPE))
cons_show("Show typing (/intype) : ON");
else
cons_show("Show typing (/intype) : OFF");
if (prefs_get_boolean(PREF_SPLASH))
cons_show("Splash screen (/splash) : ON");
else
cons_show("Splash screen (/splash) : OFF");
if (prefs_get_boolean(PREF_HISTORY))
cons_show("Chat history (/history) : ON");
else
cons_show("Chat history (/history) : OFF");
if (prefs_get_boolean(PREF_VERCHECK))
cons_show("Version checking (/vercheck) : ON");
else
cons_show("Version checking (/vercheck) : OFF");
if (prefs_get_boolean(PREF_MOUSE))
cons_show("Mouse handling (/mouse) : ON");
else
cons_show("Mouse handling (/mouse) : OFF");
if (prefs_get_boolean(PREF_STATUSES))
cons_show("Status (/statuses) : ON");
else
cons_show("Status (/statuses) : OFF");
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_show_desktop_prefs(void)
{
cons_show("Desktop notification preferences:");
cons_show("");
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON");
else
cons_show("Messages (/notify message) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_TYPING))
cons_show("Composing (/notify typing) : ON");
else
cons_show("Composing (/notify typing) : OFF");
gint remind_period = prefs_get_notify_remind();
if (remind_period == 0) {
cons_show("Reminder period (/notify remind) : OFF");
} else if (remind_period == 1) {
cons_show("Reminder period (/notify remind) : 1 second");
} else {
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
}
}
void
cons_show_chat_prefs(void)
{
cons_show("Chat preferences:");
cons_show("");
if (prefs_get_boolean(PREF_STATES))
cons_show("Send chat states (/states) : ON");
else
cons_show("Send chat states (/states) : OFF");
if (prefs_get_boolean(PREF_OUTTYPE))
cons_show("Send composing (/outtype) : ON");
else
cons_show("Send composing (/outtype) : OFF");
gint gone_time = prefs_get_gone();
if (gone_time == 0) {
cons_show("Leave conversation (/gone) : OFF");
} else if (gone_time == 1) {
cons_show("Leave conversation (/gone) : 1 minute");
} else {
cons_show("Leave conversation (/gone) : %d minutes", gone_time);
}
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_show_log_prefs(void)
{
cons_show("Logging preferences:");
cons_show("");
cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size());
if (prefs_get_boolean(PREF_CHLOG))
cons_show("Chat logging (/chlog) : ON");
else
cons_show("Chat logging (/chlog) : OFF");
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_show_presence_prefs(void)
{
cons_show("Presence preferences:");
cons_show("");
if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) {
cons_show("Autoaway (/autoaway mode) : OFF");
} else {
cons_show("Autoaway (/autoaway mode) : %s", prefs_get_string(PREF_AUTOAWAY_MODE));
}
cons_show("Autoaway minutes (/autoaway time) : %d minutes", prefs_get_autoaway_time());
if ((prefs_get_string(PREF_AUTOAWAY_MESSAGE) == NULL) ||
(strcmp(prefs_get_string(PREF_AUTOAWAY_MESSAGE), "") == 0)) {
cons_show("Autoaway message (/autoaway message) : OFF");
} else {
cons_show("Autoaway message (/autoaway message) : \"%s\"", prefs_get_string(PREF_AUTOAWAY_MESSAGE));
}
if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) {
cons_show("Autoaway check (/autoaway check) : ON");
} else {
cons_show("Autoaway check (/autoaway check) : OFF");
}
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_show_connection_prefs(void)
{
cons_show("Connection preferences:");
cons_show("");
gint reconnect_interval = prefs_get_reconnect();
if (reconnect_interval == 0) {
cons_show("Reconnect interval (/reconnect) : OFF");
} else if (reconnect_interval == 1) {
cons_show("Reconnect interval (/reconnect) : 1 second");
} else {
cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval);
}
gint autoping_interval = prefs_get_autoping();
if (autoping_interval == 0) {
cons_show("Autoping interval (/autoping) : OFF");
} else if (autoping_interval == 1) {
cons_show("Autoping interval (/autoping) : 1 second");
} else {
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
}
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_show_themes(GSList *themes)
{
cons_show("");
if (themes == NULL) {
cons_show("No available themes.");
} else {
cons_show("Available themes:");
while (themes != NULL) {
cons_show(themes->data);
themes = g_slist_next(themes);
}
}
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
void
cons_prefs(void)
{
cons_show("");
cons_show_ui_prefs();
cons_show("");
cons_show_desktop_prefs();
cons_show("");
cons_show_chat_prefs();
cons_show("");
cons_show_log_prefs();
cons_show("");
cons_show_presence_prefs();
cons_show("");
cons_show_connection_prefs();
cons_show("");
dirty = TRUE;
if (!win_current_is_console()) {
status_bar_new(0);
}
}
static void static void
_cons_splash_logo(void) _cons_splash_logo(void)
{ {

View File

@ -1146,219 +1146,6 @@ win_room_show_status(const char * const contact)
} }
} }
void
cons_show_ui_prefs(void)
{
cons_show("UI preferences:");
cons_show("");
gchar *theme = prefs_get_string(PREF_THEME);
if (theme == NULL) {
cons_show("Theme (/theme) : default");
} else {
cons_show("Theme (/theme) : %s", theme);
}
if (prefs_get_boolean(PREF_BEEP))
cons_show("Terminal beep (/beep) : ON");
else
cons_show("Terminal beep (/beep) : OFF");
if (prefs_get_boolean(PREF_FLASH))
cons_show("Terminal flash (/flash) : ON");
else
cons_show("Terminal flash (/flash) : OFF");
if (prefs_get_boolean(PREF_INTYPE))
cons_show("Show typing (/intype) : ON");
else
cons_show("Show typing (/intype) : OFF");
if (prefs_get_boolean(PREF_SPLASH))
cons_show("Splash screen (/splash) : ON");
else
cons_show("Splash screen (/splash) : OFF");
if (prefs_get_boolean(PREF_HISTORY))
cons_show("Chat history (/history) : ON");
else
cons_show("Chat history (/history) : OFF");
if (prefs_get_boolean(PREF_VERCHECK))
cons_show("Version checking (/vercheck) : ON");
else
cons_show("Version checking (/vercheck) : OFF");
if (prefs_get_boolean(PREF_MOUSE))
cons_show("Mouse handling (/mouse) : ON");
else
cons_show("Mouse handling (/mouse) : OFF");
if (prefs_get_boolean(PREF_STATUSES))
cons_show("Status (/statuses) : ON");
else
cons_show("Status (/statuses) : OFF");
}
void
cons_show_desktop_prefs(void)
{
cons_show("Desktop notification preferences:");
cons_show("");
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON");
else
cons_show("Messages (/notify message) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_TYPING))
cons_show("Composing (/notify typing) : ON");
else
cons_show("Composing (/notify typing) : OFF");
gint remind_period = prefs_get_notify_remind();
if (remind_period == 0) {
cons_show("Reminder period (/notify remind) : OFF");
} else if (remind_period == 1) {
cons_show("Reminder period (/notify remind) : 1 second");
} else {
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
}
}
void
cons_show_chat_prefs(void)
{
cons_show("Chat preferences:");
cons_show("");
if (prefs_get_boolean(PREF_STATES))
cons_show("Send chat states (/states) : ON");
else
cons_show("Send chat states (/states) : OFF");
if (prefs_get_boolean(PREF_OUTTYPE))
cons_show("Send composing (/outtype) : ON");
else
cons_show("Send composing (/outtype) : OFF");
gint gone_time = prefs_get_gone();
if (gone_time == 0) {
cons_show("Leave conversation (/gone) : OFF");
} else if (gone_time == 1) {
cons_show("Leave conversation (/gone) : 1 minute");
} else {
cons_show("Leave conversation (/gone) : %d minutes", gone_time);
}
}
void
cons_show_log_prefs(void)
{
cons_show("Logging preferences:");
cons_show("");
cons_show("Max log size (/log maxsize) : %d bytes", prefs_get_max_log_size());
if (prefs_get_boolean(PREF_CHLOG))
cons_show("Chat logging (/chlog) : ON");
else
cons_show("Chat logging (/chlog) : OFF");
}
void
cons_show_presence_prefs(void)
{
cons_show("Presence preferences:");
cons_show("");
if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "off") == 0) {
cons_show("Autoaway (/autoaway mode) : OFF");
} else {
cons_show("Autoaway (/autoaway mode) : %s", prefs_get_string(PREF_AUTOAWAY_MODE));
}
cons_show("Autoaway minutes (/autoaway time) : %d minutes", prefs_get_autoaway_time());
if ((prefs_get_string(PREF_AUTOAWAY_MESSAGE) == NULL) ||
(strcmp(prefs_get_string(PREF_AUTOAWAY_MESSAGE), "") == 0)) {
cons_show("Autoaway message (/autoaway message) : OFF");
} else {
cons_show("Autoaway message (/autoaway message) : \"%s\"", prefs_get_string(PREF_AUTOAWAY_MESSAGE));
}
if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) {
cons_show("Autoaway check (/autoaway check) : ON");
} else {
cons_show("Autoaway check (/autoaway check) : OFF");
}
}
void
cons_show_connection_prefs(void)
{
cons_show("Connection preferences:");
cons_show("");
gint reconnect_interval = prefs_get_reconnect();
if (reconnect_interval == 0) {
cons_show("Reconnect interval (/reconnect) : OFF");
} else if (reconnect_interval == 1) {
cons_show("Reconnect interval (/reconnect) : 1 second");
} else {
cons_show("Reconnect interval (/reconnect) : %d seconds", reconnect_interval);
}
gint autoping_interval = prefs_get_autoping();
if (autoping_interval == 0) {
cons_show("Autoping interval (/autoping) : OFF");
} else if (autoping_interval == 1) {
cons_show("Autoping interval (/autoping) : 1 second");
} else {
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
}
}
void
cons_show_themes(GSList *themes)
{
cons_show("");
if (themes == NULL) {
cons_show("No available themes.");
} else {
cons_show("Available themes:");
while (themes != NULL) {
cons_show(themes->data);
themes = g_slist_next(themes);
}
}
}
void
cons_prefs(void)
{
cons_show("");
cons_show_ui_prefs();
cons_show("");
cons_show_desktop_prefs();
cons_show("");
cons_show_chat_prefs();
cons_show("");
cons_show_log_prefs();
cons_show("");
cons_show_presence_prefs();
cons_show("");
cons_show_connection_prefs();
cons_show("");
if (current_index == 0) {
dirty = TRUE;
} else {
status_bar_new(0);
}
}
static void static void
_cons_show_basic_help(void) _cons_show_basic_help(void)
{ {