mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Allow utf8 in occupants char
This commit is contained in:
parent
fa2881fcea
commit
1c96115f97
@ -4414,8 +4414,8 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
|
||||
|
||||
occupantswin_occupants_all();
|
||||
} else {
|
||||
prefs_set_occupants_char(args[1][0]);
|
||||
cons_show("Occupants char set to %c.", args[1][0]);
|
||||
prefs_set_occupants_char(args[1]);
|
||||
cons_show("Occupants char set to %s.", args[1]);
|
||||
|
||||
occupantswin_occupants_all();
|
||||
}
|
||||
|
@ -902,30 +902,23 @@ prefs_get_occupants_size(void)
|
||||
}
|
||||
}
|
||||
|
||||
char
|
||||
char*
|
||||
prefs_get_occupants_char(void)
|
||||
{
|
||||
char result = 0;
|
||||
|
||||
char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
|
||||
if (!resultstr) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.char", NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_occupants_char(char ch)
|
||||
prefs_set_occupants_char(char* ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", str);
|
||||
if (g_utf8_strlen(ch, 4) == 1) {
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.char", ch);
|
||||
} else {
|
||||
log_error("Could not set roster resource char: %s", ch);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -272,8 +272,8 @@ void prefs_clear_roster_room_char(void);
|
||||
char* prefs_get_roster_room_private_char(void);
|
||||
void prefs_set_roster_room_private_char(char* ch);
|
||||
void prefs_clear_roster_room_private_char(void);
|
||||
char prefs_get_occupants_char(void);
|
||||
void prefs_set_occupants_char(char ch);
|
||||
char* prefs_get_occupants_char(void);
|
||||
void prefs_set_occupants_char(char* ch);
|
||||
void prefs_clear_occupants_char(void);
|
||||
char prefs_get_occupants_header_char(void);
|
||||
void prefs_set_occupants_header_char(char ch);
|
||||
|
@ -406,8 +406,8 @@ _load_preferences(void)
|
||||
// with custom set functions
|
||||
if (g_key_file_has_key(theme, "ui", "occupants.char", NULL)) {
|
||||
gchar* ch = g_key_file_get_string(theme, "ui", "occupants.char", NULL);
|
||||
if (ch && strlen(ch) > 0) {
|
||||
prefs_set_occupants_char(ch[0]);
|
||||
if (ch && g_utf8_strlen(ch, 4) == 1) {
|
||||
prefs_set_occupants_char(ch);
|
||||
g_free(ch);
|
||||
}
|
||||
}
|
||||
|
@ -1340,11 +1340,13 @@ cons_occupants_setting(void)
|
||||
else
|
||||
cons_show("Occupants wrap (/occupants) : OFF");
|
||||
|
||||
char occupants_ch = prefs_get_occupants_char();
|
||||
if (occupants_ch)
|
||||
cons_show("Occupants char (/occupants) : %c", occupants_ch);
|
||||
else
|
||||
char* occupants_ch = prefs_get_occupants_char();
|
||||
if (occupants_ch) {
|
||||
cons_show("Occupants char (/occupants) : %s", occupants_ch);
|
||||
free(occupants_ch);
|
||||
} else {
|
||||
cons_show("Occupants char (/occupants) : none");
|
||||
}
|
||||
|
||||
gint occupant_indent = prefs_get_occupants_indent();
|
||||
cons_show("Occupant indent (/occupants) : %d", occupant_indent);
|
||||
@ -1509,7 +1511,7 @@ cons_roster_setting(void)
|
||||
|
||||
char* room_priv_ch = prefs_get_roster_room_private_char();
|
||||
if (room_priv_ch) {
|
||||
cons_show("Roster room private char (/roster) : %c", room_priv_ch);
|
||||
cons_show("Roster room private char (/roster) : %s", room_priv_ch);
|
||||
free(room_priv_ch);
|
||||
} else {
|
||||
cons_show("Roster room private char (/roster) : none");
|
||||
@ -1517,7 +1519,7 @@ cons_roster_setting(void)
|
||||
|
||||
char* private_ch = prefs_get_roster_private_char();
|
||||
if (private_ch) {
|
||||
cons_show("Roster private char (/roster) : %c", private_ch);
|
||||
cons_show("Roster private char (/roster) : %s", private_ch);
|
||||
free(private_ch);
|
||||
} else {
|
||||
cons_show("Roster private char (/roster) : none");
|
||||
|
@ -77,9 +77,10 @@ _occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid,
|
||||
|
||||
GString* msg = g_string_new(spaces->str);
|
||||
|
||||
char ch = prefs_get_occupants_char();
|
||||
char* ch = prefs_get_occupants_char();
|
||||
if (ch) {
|
||||
g_string_append_printf(msg, "%c", ch);
|
||||
g_string_append_printf(msg, "%s", ch);
|
||||
free(ch);
|
||||
}
|
||||
|
||||
gboolean wrap = prefs_get_boolean(PREF_OCCUPANTS_WRAP);
|
||||
|
Loading…
Reference in New Issue
Block a user