mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Allow utf8 in occupants header char
This commit is contained in:
parent
1c96115f97
commit
a9bcc8e8bd
@ -2389,7 +2389,7 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
|
|||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
} else {
|
} else {
|
||||||
prefs_set_roster_header_char(args[2]);
|
prefs_set_roster_header_char(args[2]);
|
||||||
cons_show("Roster header char set to %c.", args[2]);
|
cons_show("Roster header char set to %s.", args[2]);
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4470,8 +4470,8 @@ cmd_occupants(ProfWin* window, const char* const command, gchar** args)
|
|||||||
|
|
||||||
occupantswin_occupants_all();
|
occupantswin_occupants_all();
|
||||||
} else {
|
} else {
|
||||||
prefs_set_occupants_header_char(args[2][0]);
|
prefs_set_occupants_header_char(args[2]);
|
||||||
cons_show("Occupants header char set to %c.", args[2][0]);
|
cons_show("Occupants header char set to %s.", args[2]);
|
||||||
|
|
||||||
occupantswin_occupants_all();
|
occupantswin_occupants_all();
|
||||||
}
|
}
|
||||||
|
@ -948,30 +948,22 @@ prefs_set_occupants_indent(gint value)
|
|||||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "occupants.indent", value);
|
g_key_file_set_integer(prefs, PREF_GROUP_UI, "occupants.indent", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
char*
|
||||||
prefs_get_occupants_header_char(void)
|
prefs_get_occupants_header_char(void)
|
||||||
{
|
{
|
||||||
char result = 0;
|
char* result = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
|
||||||
|
|
||||||
char* resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "occupants.header.char", NULL);
|
|
||||||
if (!resultstr) {
|
|
||||||
result = 0;
|
|
||||||
} else {
|
|
||||||
result = resultstr[0];
|
|
||||||
}
|
|
||||||
free(resultstr);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prefs_set_occupants_header_char(char ch)
|
prefs_set_occupants_header_char(char* ch)
|
||||||
{
|
{
|
||||||
char str[2];
|
if (g_utf8_strlen(ch, 4) == 1) {
|
||||||
str[0] = ch;
|
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.header.char", ch);
|
||||||
str[1] = '\0';
|
} else {
|
||||||
|
log_error("Could not set roster resource char: %s", ch);
|
||||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "occupants.header.char", str);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -275,8 +275,8 @@ void prefs_clear_roster_room_private_char(void);
|
|||||||
char* prefs_get_occupants_char(void);
|
char* prefs_get_occupants_char(void);
|
||||||
void prefs_set_occupants_char(char* ch);
|
void prefs_set_occupants_char(char* ch);
|
||||||
void prefs_clear_occupants_char(void);
|
void prefs_clear_occupants_char(void);
|
||||||
char prefs_get_occupants_header_char(void);
|
char* prefs_get_occupants_header_char(void);
|
||||||
void prefs_set_occupants_header_char(char ch);
|
void prefs_set_occupants_header_char(char* ch);
|
||||||
void prefs_clear_occupants_header_char(void);
|
void prefs_clear_occupants_header_char(void);
|
||||||
|
|
||||||
gint prefs_get_roster_contact_indent(void);
|
gint prefs_get_roster_contact_indent(void);
|
||||||
|
@ -414,8 +414,8 @@ _load_preferences(void)
|
|||||||
|
|
||||||
if (g_key_file_has_key(theme, "ui", "occupants.header.char", NULL)) {
|
if (g_key_file_has_key(theme, "ui", "occupants.header.char", NULL)) {
|
||||||
gchar* ch = g_key_file_get_string(theme, "ui", "occupants.header.char", NULL);
|
gchar* ch = g_key_file_get_string(theme, "ui", "occupants.header.char", NULL);
|
||||||
if (ch && strlen(ch) > 0) {
|
if (ch && g_utf8_strlen(ch, 4) == 1) {
|
||||||
prefs_set_occupants_header_char(ch[0]);
|
prefs_set_occupants_header_char(ch);
|
||||||
g_free(ch);
|
g_free(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1354,12 +1354,14 @@ cons_occupants_setting(void)
|
|||||||
int size = prefs_get_occupants_size();
|
int size = prefs_get_occupants_size();
|
||||||
cons_show("Occupants size (/occupants) : %d", size);
|
cons_show("Occupants size (/occupants) : %d", size);
|
||||||
|
|
||||||
char header_ch = prefs_get_occupants_header_char();
|
char* header_ch = prefs_get_occupants_header_char();
|
||||||
if (header_ch)
|
if (header_ch) {
|
||||||
cons_show("Occupants header char (/occupants) : %c", header_ch);
|
cons_show("Occupants header char (/occupants) : %s", header_ch);
|
||||||
else
|
free(header_ch);
|
||||||
|
} else {
|
||||||
cons_show("Occupants header char (/occupants) : none");
|
cons_show("Occupants header char (/occupants) : none");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_rooms_cache_setting(void)
|
cons_rooms_cache_setting(void)
|
||||||
|
@ -131,9 +131,10 @@ occupantswin_occupants(const char* const roomjid)
|
|||||||
|
|
||||||
GString* prefix = g_string_new(" ");
|
GString* prefix = g_string_new(" ");
|
||||||
|
|
||||||
char ch = prefs_get_occupants_header_char();
|
char* ch = prefs_get_occupants_header_char();
|
||||||
if (ch) {
|
if (ch) {
|
||||||
g_string_append_printf(prefix, "%c", ch);
|
g_string_append_printf(prefix, "%s", ch);
|
||||||
|
free(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user