mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added [ui] preferences to themes
This commit is contained in:
parent
1a896d7b53
commit
20fa96325d
@ -715,6 +715,16 @@ cmd_theme(gchar **args, struct cmd_help_t help)
|
||||
} else if (theme_load(args[1])) {
|
||||
ui_load_colours();
|
||||
prefs_set_string(PREF_THEME, args[1]);
|
||||
if (prefs_get_boolean(PREF_ROSTER)) {
|
||||
ui_show_roster();
|
||||
} else {
|
||||
ui_hide_roster();
|
||||
}
|
||||
if (prefs_get_boolean(PREF_OCCUPANTS)) {
|
||||
ui_show_all_room_rosters();
|
||||
} else {
|
||||
ui_hide_all_room_rosters();
|
||||
}
|
||||
ui_redraw();
|
||||
cons_show("Loaded theme: %s", args[1]);
|
||||
} else {
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "theme.h"
|
||||
#include "preferences.h"
|
||||
|
||||
static GString *theme_loc;
|
||||
static GKeyFile *theme;
|
||||
@ -125,6 +126,7 @@ static struct colours_t {
|
||||
static NCURSES_COLOR_T _lookup_colour(const char * const colour);
|
||||
static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def, theme_item_t theme_item);
|
||||
static void _load_colours(void);
|
||||
static void _load_preferences(void);
|
||||
static gchar * _get_themes_dir(void);
|
||||
void _theme_list_dir(const gchar * const dir, GSList **result);
|
||||
static GString * _theme_find(const char * const theme_name);
|
||||
@ -169,6 +171,7 @@ theme_load(const char * const theme_name)
|
||||
}
|
||||
|
||||
_load_colours();
|
||||
_load_preferences();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -381,6 +384,59 @@ _load_colours(void)
|
||||
_set_colour("occupants.header", &colour_prefs.occupantsheader, COLOR_YELLOW, THEME_OCCUPANTS_HEADER);
|
||||
}
|
||||
|
||||
static void
|
||||
_set_string_preference(char *prefstr, preference_t pref)
|
||||
{
|
||||
if (g_key_file_has_key(theme, "ui", prefstr, NULL)) {
|
||||
gchar *val = g_key_file_get_string(theme, "ui", prefstr, NULL);
|
||||
prefs_set_string(pref, val);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_set_boolean_preference(char *prefstr, preference_t pref)
|
||||
{
|
||||
if (g_key_file_has_key(theme, "ui", prefstr, NULL)) {
|
||||
gboolean val = g_key_file_get_boolean(theme, "ui", prefstr, NULL);
|
||||
prefs_set_boolean(pref, val);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_load_preferences(void)
|
||||
{
|
||||
_set_boolean_preference("intype", PREF_INTYPE);
|
||||
_set_boolean_preference("beep", PREF_BEEP);
|
||||
_set_boolean_preference("flash", PREF_FLASH);
|
||||
_set_boolean_preference("privileges", PREF_MUC_PRIVILEGES);
|
||||
_set_boolean_preference("presence", PREF_PRESENCE);
|
||||
_set_boolean_preference("wrap", PREF_WRAP);
|
||||
|
||||
_set_string_preference("time", PREF_TIME);
|
||||
_set_string_preference("statuses.muc", PREF_STATUSES_MUC);
|
||||
_set_string_preference("statuses.console", PREF_STATUSES_CONSOLE);
|
||||
_set_string_preference("statuses.chat", PREF_STATUSES_CHAT);
|
||||
|
||||
_set_boolean_preference("occupants", PREF_OCCUPANTS);
|
||||
|
||||
if (g_key_file_has_key(theme, "ui", "occupants.size", NULL)) {
|
||||
gint occupants_size = g_key_file_get_integer(theme, "ui", "occupants.size", NULL);
|
||||
prefs_set_occupants_size(occupants_size);
|
||||
}
|
||||
|
||||
_set_boolean_preference("roster", PREF_ROSTER);
|
||||
_set_boolean_preference("roster.offline", PREF_ROSTER_OFFLINE);
|
||||
_set_boolean_preference("roster.resource", PREF_ROSTER_RESOURCE);
|
||||
_set_string_preference("roster.by", PREF_ROSTER_BY);
|
||||
|
||||
if (g_key_file_has_key(theme, "ui", "roster.size", NULL)) {
|
||||
gint roster_size = g_key_file_get_integer(theme, "ui", "roster.size", NULL);
|
||||
prefs_set_roster_size(roster_size);
|
||||
}
|
||||
|
||||
_set_boolean_preference("otr.warn", PREF_OTR_WARN);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
_get_themes_dir(void)
|
||||
{
|
||||
|
@ -706,6 +706,46 @@ _ui_redraw_all_room_rosters(void)
|
||||
g_list_free(win_nums);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_hide_all_room_rosters(void)
|
||||
{
|
||||
GList *win_nums = wins_get_nums();
|
||||
GList *curr = win_nums;
|
||||
|
||||
while (curr != NULL) {
|
||||
int num = GPOINTER_TO_INT(curr->data);
|
||||
ProfWin *window = wins_get_by_num(num);
|
||||
if (window->type == WIN_MUC && window->subwin) {
|
||||
char *room = window->from;
|
||||
ui_room_hide_occupants(room);
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free(curr);
|
||||
g_list_free(win_nums);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_show_all_room_rosters(void)
|
||||
{
|
||||
GList *win_nums = wins_get_nums();
|
||||
GList *curr = win_nums;
|
||||
|
||||
while (curr != NULL) {
|
||||
int num = GPOINTER_TO_INT(curr->data);
|
||||
ProfWin *window = wins_get_by_num(num);
|
||||
if (window->type == WIN_MUC && window->subwin == NULL) {
|
||||
char *room = window->from;
|
||||
ui_room_show_occupants(room);
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free(curr);
|
||||
g_list_free(win_nums);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_ui_win_has_unsaved_form(int num)
|
||||
{
|
||||
@ -3424,4 +3464,7 @@ ui_init_module(void)
|
||||
ui_room_occupant_role_and_affiliation_change = _ui_room_occupant_role_and_affiliation_change;
|
||||
ui_redraw_all_room_rosters = _ui_redraw_all_room_rosters;
|
||||
ui_redraw = _ui_redraw;
|
||||
ui_show_all_room_rosters = _ui_show_all_room_rosters;
|
||||
ui_hide_all_room_rosters = _ui_hide_all_room_rosters;
|
||||
}
|
||||
|
||||
|
@ -209,6 +209,8 @@ void (*ui_show_form_help)(ProfWin *window, DataForm *form);
|
||||
void (*ui_show_form_field_help)(ProfWin *window, DataForm *form, char *tag);
|
||||
void (*ui_show_lines)(ProfWin *window, const gchar** lines);
|
||||
void (*ui_redraw_all_room_rosters)(void);
|
||||
void (*ui_show_all_room_rosters)(void);
|
||||
void (*ui_hide_all_room_rosters)(void);
|
||||
|
||||
// contact status functions
|
||||
void (*ui_status_room)(const char * const contact);
|
||||
|
69
themes/advanced
Normal file
69
themes/advanced
Normal file
@ -0,0 +1,69 @@
|
||||
[colours]
|
||||
bkgnd=default
|
||||
titlebar=blue
|
||||
statusbar=blue
|
||||
titlebar.text=bold_white
|
||||
titlebar.brackets=white
|
||||
statusbar.text=bold_white
|
||||
statusbar.brackets=white
|
||||
statusbar.active=bold_cyan
|
||||
statusbar.new=bold_green
|
||||
main.text=white
|
||||
main.text.me=cyan
|
||||
main.text.them=bold_white
|
||||
input.text=bold_green
|
||||
main.time=yellow
|
||||
main.splash=bold_red
|
||||
online=bold_green
|
||||
away=bold_cyan
|
||||
chat=bold_white
|
||||
dnd=magenta
|
||||
xa=bold_blue
|
||||
offline=red
|
||||
typing=yellow
|
||||
gone=red
|
||||
error=red
|
||||
incoming=bold_yellow
|
||||
roominfo=yellow
|
||||
roommention=bold_red
|
||||
me=blue
|
||||
them=bold_green
|
||||
titlebar.unencrypted=bold_red
|
||||
titlebar.encrypted=bold_white
|
||||
titlebar.untrusted=bold_yellow
|
||||
titlebar.trusted=bold_white
|
||||
titlebar.online=bold_green
|
||||
titlebar.offline=bold_red
|
||||
titlebar.away=bold_cyan
|
||||
titlebar.xa=bold_cyan
|
||||
titlebar.dnd=bold_red
|
||||
titlebar.chat=bold_green
|
||||
otr.started.trusted=green
|
||||
otr.started.untrusted=yellow
|
||||
otr.ended=red
|
||||
otr.trusted=green
|
||||
otr.untrusted=yellow
|
||||
roster.header=bold_yellow
|
||||
occupants.header=bold_yellow
|
||||
|
||||
[ui]
|
||||
intype=true
|
||||
beep=false
|
||||
flash=flase
|
||||
privileges=true
|
||||
presence=true
|
||||
wrap=true
|
||||
time=minutes
|
||||
statuses.muc=off
|
||||
statuses.chat=online
|
||||
statuses.console=off
|
||||
occupants=true
|
||||
occupants.size=15
|
||||
roster=true
|
||||
roster.size=25
|
||||
roster.offline=true
|
||||
roster.resource=true
|
||||
roster.by=presence
|
||||
otr.warn=true
|
||||
|
||||
|
@ -17,9 +17,9 @@ main.splash=bold_red
|
||||
online=bold_green
|
||||
away=bold_cyan
|
||||
chat=bold_white
|
||||
dnd=bold_red
|
||||
dnd=magenta
|
||||
xa=bold_blue
|
||||
offline=bold_black
|
||||
offline=red
|
||||
typing=yellow
|
||||
gone=red
|
||||
error=red
|
||||
@ -45,3 +45,25 @@ otr.trusted=green
|
||||
otr.untrusted=yellow
|
||||
roster.header=bold_yellow
|
||||
occupants.header=bold_yellow
|
||||
|
||||
[ui]
|
||||
intype=true
|
||||
beep=false
|
||||
flash=flase
|
||||
privileges=true
|
||||
presence=true
|
||||
wrap=true
|
||||
time=minutes
|
||||
statuses.muc=off
|
||||
statuses.chat=online
|
||||
statuses.console=all
|
||||
occupants=true
|
||||
occupants.size=15
|
||||
roster=true
|
||||
roster.size=25
|
||||
roster.offline=true
|
||||
roster.resource=true
|
||||
roster.by=presence
|
||||
otr.warn=true
|
||||
|
||||
|
||||
|
62
themes/minimal
Normal file
62
themes/minimal
Normal file
@ -0,0 +1,62 @@
|
||||
[colours]
|
||||
bkgnd=default
|
||||
titlebar=blue
|
||||
statusbar=blue
|
||||
titlebar.text=bold_white
|
||||
titlebar.brackets=white
|
||||
statusbar.text=bold_white
|
||||
statusbar.brackets=white
|
||||
statusbar.active=bold_cyan
|
||||
statusbar.new=bold_green
|
||||
main.text=white
|
||||
main.text.me=cyan
|
||||
main.text.them=bold_white
|
||||
input.text=bold_green
|
||||
main.time=yellow
|
||||
main.splash=bold_red
|
||||
online=bold_green
|
||||
away=bold_cyan
|
||||
chat=bold_white
|
||||
dnd=magenta
|
||||
xa=bold_blue
|
||||
offline=red
|
||||
typing=yellow
|
||||
gone=red
|
||||
error=red
|
||||
incoming=bold_yellow
|
||||
roominfo=yellow
|
||||
roommention=bold_red
|
||||
me=blue
|
||||
them=bold_green
|
||||
titlebar.unencrypted=bold_red
|
||||
titlebar.encrypted=bold_white
|
||||
titlebar.untrusted=bold_yellow
|
||||
titlebar.trusted=bold_white
|
||||
titlebar.online=bold_green
|
||||
titlebar.offline=bold_red
|
||||
titlebar.away=bold_cyan
|
||||
titlebar.xa=bold_cyan
|
||||
titlebar.dnd=bold_red
|
||||
titlebar.chat=bold_green
|
||||
otr.started.trusted=green
|
||||
otr.started.untrusted=yellow
|
||||
otr.ended=red
|
||||
otr.trusted=green
|
||||
otr.untrusted=yellow
|
||||
roster.header=bold_yellow
|
||||
occupants.header=bold_yellow
|
||||
|
||||
[ui]
|
||||
intype=true
|
||||
beep=false
|
||||
flash=false
|
||||
privileges=false
|
||||
presence=false
|
||||
wrap=false
|
||||
time=off
|
||||
statuses.muc=all
|
||||
statuses.chat=all
|
||||
statuses.console=all
|
||||
occupants=false
|
||||
roster=false
|
||||
otr.warn=false
|
47
themes/mono
Normal file
47
themes/mono
Normal file
@ -0,0 +1,47 @@
|
||||
[colours]
|
||||
bkgnd=default
|
||||
titlebar=white
|
||||
statusbar=white
|
||||
titlebar.text=black
|
||||
titlebar.brackets=black
|
||||
statusbar.text=black
|
||||
statusbar.brackets=black
|
||||
statusbar.active=black
|
||||
statusbar.new=black
|
||||
main.text=white
|
||||
main.text.me=white
|
||||
main.text.them=white
|
||||
input.text=white
|
||||
main.time=white
|
||||
main.splash=white
|
||||
online=white
|
||||
away=white
|
||||
chat=white
|
||||
dnd=white
|
||||
xa=white
|
||||
offline=white
|
||||
typing=white
|
||||
gone=white
|
||||
error=white
|
||||
incoming=white
|
||||
roominfo=white
|
||||
roommention=white
|
||||
me=white
|
||||
them=white
|
||||
titlebar.unencrypted=black
|
||||
titlebar.encrypted=black
|
||||
titlebar.untrusted=black
|
||||
titlebar.trusted=black
|
||||
titlebar.online=black
|
||||
titlebar.offline=black
|
||||
titlebar.away=black
|
||||
titlebar.xa=black
|
||||
titlebar.dnd=black
|
||||
titlebar.chat=black
|
||||
otr.started.trusted=white
|
||||
otr.started.untrusted=white
|
||||
otr.ended=white
|
||||
otr.trusted=white
|
||||
otr.untrusted=white
|
||||
roster.header=white
|
||||
occupants.header=white
|
67
themes/simple
Normal file
67
themes/simple
Normal file
@ -0,0 +1,67 @@
|
||||
[colours]
|
||||
bkgnd=default
|
||||
titlebar=blue
|
||||
statusbar=blue
|
||||
titlebar.text=bold_white
|
||||
titlebar.brackets=white
|
||||
statusbar.text=bold_white
|
||||
statusbar.brackets=white
|
||||
statusbar.active=bold_cyan
|
||||
statusbar.new=bold_green
|
||||
main.text=white
|
||||
main.text.me=cyan
|
||||
main.text.them=bold_white
|
||||
input.text=bold_green
|
||||
main.time=yellow
|
||||
main.splash=bold_red
|
||||
online=bold_green
|
||||
away=bold_cyan
|
||||
chat=bold_white
|
||||
dnd=magenta
|
||||
xa=bold_blue
|
||||
offline=red
|
||||
typing=yellow
|
||||
gone=red
|
||||
error=red
|
||||
incoming=bold_yellow
|
||||
roominfo=yellow
|
||||
roommention=bold_red
|
||||
me=blue
|
||||
them=bold_green
|
||||
titlebar.unencrypted=bold_red
|
||||
titlebar.encrypted=bold_white
|
||||
titlebar.untrusted=bold_yellow
|
||||
titlebar.trusted=bold_white
|
||||
titlebar.online=bold_green
|
||||
titlebar.offline=bold_red
|
||||
titlebar.away=bold_cyan
|
||||
titlebar.xa=bold_cyan
|
||||
titlebar.dnd=bold_red
|
||||
titlebar.chat=bold_green
|
||||
otr.started.trusted=green
|
||||
otr.started.untrusted=yellow
|
||||
otr.ended=red
|
||||
otr.trusted=green
|
||||
otr.untrusted=yellow
|
||||
roster.header=bold_yellow
|
||||
occupants.header=bold_yellow
|
||||
|
||||
[ui]
|
||||
intype=false
|
||||
beep=false
|
||||
flash=false
|
||||
privileges=false
|
||||
presence=false
|
||||
wrap=true
|
||||
time=minutes
|
||||
statuses.muc=off
|
||||
statuses.chat=online
|
||||
statuses.console=off
|
||||
occupants=true
|
||||
occupants.size=15
|
||||
roster=true
|
||||
roster.size=25
|
||||
roster.offline=false
|
||||
roster.resource=false
|
||||
roster.by=presence
|
||||
otr.warn=false
|
Loading…
Reference in New Issue
Block a user