mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added /time setting
This commit is contained in:
parent
1479a5e134
commit
40dc8e2c49
@ -597,6 +597,14 @@ static struct cmd_t command_defs[] =
|
|||||||
"Enable or disable word wrapping.",
|
"Enable or disable word wrapping.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/time",
|
||||||
|
cmd_time, parse_args, 1, 1, &cons_time_setting,
|
||||||
|
{ "/time minutes|seconds", "Time display.",
|
||||||
|
{ "/time minutes|seconds",
|
||||||
|
"---------------------",
|
||||||
|
"Configure time precision for the main window.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
{ "/notify",
|
{ "/notify",
|
||||||
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
||||||
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
||||||
@ -1071,6 +1079,7 @@ static Autocomplete form_ac;
|
|||||||
static Autocomplete form_field_multi_ac;
|
static Autocomplete form_field_multi_ac;
|
||||||
static Autocomplete occupants_ac;
|
static Autocomplete occupants_ac;
|
||||||
static Autocomplete occupants_default_ac;
|
static Autocomplete occupants_default_ac;
|
||||||
|
static Autocomplete time_ac;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise command autocompleter and history
|
* Initialise command autocompleter and history
|
||||||
@ -1397,6 +1406,10 @@ cmd_init(void)
|
|||||||
autocomplete_add(occupants_default_ac, "show");
|
autocomplete_add(occupants_default_ac, "show");
|
||||||
autocomplete_add(occupants_default_ac, "hide");
|
autocomplete_add(occupants_default_ac, "hide");
|
||||||
|
|
||||||
|
time_ac = autocomplete_new();
|
||||||
|
autocomplete_add(time_ac, "minutes");
|
||||||
|
autocomplete_add(time_ac, "seconds");
|
||||||
|
|
||||||
cmd_history_init();
|
cmd_history_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1450,6 +1463,7 @@ cmd_uninit(void)
|
|||||||
autocomplete_free(form_field_multi_ac);
|
autocomplete_free(form_field_multi_ac);
|
||||||
autocomplete_free(occupants_ac);
|
autocomplete_free(occupants_ac);
|
||||||
autocomplete_free(occupants_default_ac);
|
autocomplete_free(occupants_default_ac);
|
||||||
|
autocomplete_free(time_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -1620,6 +1634,7 @@ cmd_reset_autocomplete()
|
|||||||
autocomplete_reset(form_field_multi_ac);
|
autocomplete_reset(form_field_multi_ac);
|
||||||
autocomplete_reset(occupants_ac);
|
autocomplete_reset(occupants_ac);
|
||||||
autocomplete_reset(occupants_default_ac);
|
autocomplete_reset(occupants_default_ac);
|
||||||
|
autocomplete_reset(time_ac);
|
||||||
|
|
||||||
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
||||||
ProfWin *window = wins_get_current();
|
ProfWin *window = wins_get_current();
|
||||||
@ -1885,8 +1900,8 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/subject", "/room" };
|
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/subject", "/room", "/time" };
|
||||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, subject_ac, room_ac };
|
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, subject_ac, room_ac, time_ac };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||||
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
||||||
|
@ -3030,6 +3030,25 @@ cmd_wrap(gchar **args, struct cmd_help_t help)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cmd_time(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
if (g_strcmp0(args[0], "minutes") == 0) {
|
||||||
|
prefs_set_string(PREF_TIME, "minutes");
|
||||||
|
cons_show("Time precision set to minutes.");
|
||||||
|
wins_resize_all();
|
||||||
|
return TRUE;
|
||||||
|
} else if (g_strcmp0(args[0], "seconds") == 0) {
|
||||||
|
prefs_set_string(PREF_TIME, "seconds");
|
||||||
|
cons_show("Time precision set to seconds.");
|
||||||
|
wins_resize_all();
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_states(gchar **args, struct cmd_help_t help)
|
cmd_states(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -134,6 +134,7 @@ gboolean cmd_role(gchar **args, struct cmd_help_t help);
|
|||||||
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
|
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_wrap(gchar **args, struct cmd_help_t help);
|
gboolean cmd_wrap(gchar **args, struct cmd_help_t help);
|
||||||
|
gboolean cmd_time(gchar **args, struct cmd_help_t help);
|
||||||
|
|
||||||
gboolean cmd_form_field(char *tag, gchar **args);
|
gboolean cmd_form_field(char *tag, gchar **args);
|
||||||
|
|
||||||
|
@ -491,6 +491,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_MUC_PRIVILEGES:
|
case PREF_MUC_PRIVILEGES:
|
||||||
case PREF_PRESENCE:
|
case PREF_PRESENCE:
|
||||||
case PREF_WRAP:
|
case PREF_WRAP:
|
||||||
|
case PREF_TIME:
|
||||||
case PREF_ROSTER:
|
case PREF_ROSTER:
|
||||||
case PREF_ROSTER_OFFLINE:
|
case PREF_ROSTER_OFFLINE:
|
||||||
case PREF_ROSTER_RESOURCE:
|
case PREF_ROSTER_RESOURCE:
|
||||||
@ -615,6 +616,8 @@ _get_key(preference_t pref)
|
|||||||
return "presence";
|
return "presence";
|
||||||
case PREF_WRAP:
|
case PREF_WRAP:
|
||||||
return "wrap";
|
return "wrap";
|
||||||
|
case PREF_TIME:
|
||||||
|
return "time";
|
||||||
case PREF_ROSTER:
|
case PREF_ROSTER:
|
||||||
return "roster";
|
return "roster";
|
||||||
case PREF_ROSTER_OFFLINE:
|
case PREF_ROSTER_OFFLINE:
|
||||||
@ -670,6 +673,8 @@ _get_default_string(preference_t pref)
|
|||||||
return "all";
|
return "all";
|
||||||
case PREF_ROSTER_BY:
|
case PREF_ROSTER_BY:
|
||||||
return "none";
|
return "none";
|
||||||
|
case PREF_TIME:
|
||||||
|
return "seconds";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ typedef enum {
|
|||||||
PREF_MUC_PRIVILEGES,
|
PREF_MUC_PRIVILEGES,
|
||||||
PREF_PRESENCE,
|
PREF_PRESENCE,
|
||||||
PREF_WRAP,
|
PREF_WRAP,
|
||||||
|
PREF_TIME,
|
||||||
PREF_STATUSES,
|
PREF_STATUSES,
|
||||||
PREF_STATUSES_CONSOLE,
|
PREF_STATUSES_CONSOLE,
|
||||||
PREF_STATUSES_CHAT,
|
PREF_STATUSES_CHAT,
|
||||||
|
@ -900,6 +900,18 @@ _cons_autoconnect_setting(void)
|
|||||||
prefs_free_string(pref_connect_account);
|
prefs_free_string(pref_connect_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cons_time_setting(void)
|
||||||
|
{
|
||||||
|
char *pref_time = prefs_get_string(PREF_TIME);
|
||||||
|
if (g_strcmp0(pref_time, "minutes") == 0)
|
||||||
|
cons_show("Time (/time) : minutes");
|
||||||
|
else
|
||||||
|
cons_show("Time (/time) : seconds");
|
||||||
|
|
||||||
|
prefs_free_string(pref_time);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cons_vercheck_setting(void)
|
_cons_vercheck_setting(void)
|
||||||
{
|
{
|
||||||
@ -976,6 +988,7 @@ _cons_show_ui_prefs(void)
|
|||||||
cons_flash_setting();
|
cons_flash_setting();
|
||||||
cons_splash_setting();
|
cons_splash_setting();
|
||||||
cons_wrap_setting();
|
cons_wrap_setting();
|
||||||
|
cons_time_setting();
|
||||||
cons_vercheck_setting();
|
cons_vercheck_setting();
|
||||||
cons_mouse_setting();
|
cons_mouse_setting();
|
||||||
cons_statuses_setting();
|
cons_statuses_setting();
|
||||||
@ -1594,6 +1607,7 @@ console_init_module(void)
|
|||||||
cons_privileges_setting = _cons_privileges_setting;
|
cons_privileges_setting = _cons_privileges_setting;
|
||||||
cons_beep_setting = _cons_beep_setting;
|
cons_beep_setting = _cons_beep_setting;
|
||||||
cons_wrap_setting = _cons_wrap_setting;
|
cons_wrap_setting = _cons_wrap_setting;
|
||||||
|
cons_time_setting = _cons_time_setting;
|
||||||
cons_presence_setting = _cons_presence_setting;
|
cons_presence_setting = _cons_presence_setting;
|
||||||
cons_flash_setting = _cons_flash_setting;
|
cons_flash_setting = _cons_flash_setting;
|
||||||
cons_splash_setting = _cons_splash_setting;
|
cons_splash_setting = _cons_splash_setting;
|
||||||
|
@ -303,6 +303,7 @@ void (*cons_occupants_setting)(void);
|
|||||||
void (*cons_roster_setting)(void);
|
void (*cons_roster_setting)(void);
|
||||||
void (*cons_presence_setting)(void);
|
void (*cons_presence_setting)(void);
|
||||||
void (*cons_wrap_setting)(void);
|
void (*cons_wrap_setting)(void);
|
||||||
|
void (*cons_time_setting)(void);
|
||||||
void (*cons_mouse_setting)(void);
|
void (*cons_mouse_setting)(void);
|
||||||
void (*cons_statuses_setting)(void);
|
void (*cons_statuses_setting)(void);
|
||||||
void (*cons_titlebar_setting)(void);
|
void (*cons_titlebar_setting)(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user