mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge remote-tracking branch 'quite/hideempty'
This commit is contained in:
commit
dd480cd72a
@ -196,9 +196,11 @@ static struct cmd_t command_defs[] =
|
||||
"show : Show the roster panel.",
|
||||
"show offline : Show offline contacts in the roster panel.",
|
||||
"show resource : Show contact's connected resources in the roster panel.",
|
||||
"show empty : When grouping by presence, show empty presence groups",
|
||||
"hide : Hide the roster panel.",
|
||||
"hide offline : Hide offline contacts in the roster panel.",
|
||||
"hide resource : Hide contact's connected resources in the roster panel.",
|
||||
"hide empty : When grouping by presence, hide empty presence groups",
|
||||
"by group : Group contacts in the roster panel by roster group.",
|
||||
"by presence : Group contacts in the roster panel by presence.",
|
||||
"by none : No grouping in the roster panel.",
|
||||
@ -1439,6 +1441,7 @@ cmd_init(void)
|
||||
roster_option_ac = autocomplete_new();
|
||||
autocomplete_add(roster_option_ac, "offline");
|
||||
autocomplete_add(roster_option_ac, "resource");
|
||||
autocomplete_add(roster_option_ac, "empty");
|
||||
|
||||
roster_by_ac = autocomplete_new();
|
||||
autocomplete_add(roster_by_ac, "group");
|
||||
|
@ -1578,6 +1578,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "empty") == 0) {
|
||||
cons_show("Roster empty enabled");
|
||||
prefs_set_boolean(PREF_ROSTER_EMPTY, TRUE);
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
return TRUE;
|
||||
@ -1604,6 +1611,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[1], "empty") == 0) {
|
||||
cons_show("Roster empty disabled");
|
||||
prefs_set_boolean(PREF_ROSTER_EMPTY, FALSE);
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
return TRUE;
|
||||
|
@ -522,6 +522,7 @@ _get_group(preference_t pref)
|
||||
case PREF_ROSTER:
|
||||
case PREF_ROSTER_OFFLINE:
|
||||
case PREF_ROSTER_RESOURCE:
|
||||
case PREF_ROSTER_EMPTY:
|
||||
case PREF_ROSTER_BY:
|
||||
case PREF_RESOURCE_TITLE:
|
||||
case PREF_RESOURCE_MESSAGE:
|
||||
@ -676,6 +677,8 @@ _get_key(preference_t pref)
|
||||
return "roster.offline";
|
||||
case PREF_ROSTER_RESOURCE:
|
||||
return "roster.resource";
|
||||
case PREF_ROSTER_EMPTY:
|
||||
return "roster.empty";
|
||||
case PREF_ROSTER_BY:
|
||||
return "roster.by";
|
||||
case PREF_RESOURCE_TITLE:
|
||||
@ -723,6 +726,7 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_ROSTER:
|
||||
case PREF_ROSTER_OFFLINE:
|
||||
case PREF_ROSTER_RESOURCE:
|
||||
case PREF_ROSTER_EMPTY:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -65,6 +65,7 @@ typedef enum {
|
||||
PREF_ROSTER_SIZE,
|
||||
PREF_ROSTER_OFFLINE,
|
||||
PREF_ROSTER_RESOURCE,
|
||||
PREF_ROSTER_EMPTY,
|
||||
PREF_ROSTER_BY,
|
||||
PREF_MUC_PRIVILEGES,
|
||||
PREF_PRESENCE,
|
||||
|
@ -452,6 +452,7 @@ _load_preferences(void)
|
||||
_set_boolean_preference("roster", PREF_ROSTER);
|
||||
_set_boolean_preference("roster.offline", PREF_ROSTER_OFFLINE);
|
||||
_set_boolean_preference("roster.resource", PREF_ROSTER_RESOURCE);
|
||||
_set_boolean_preference("roster.empty", PREF_ROSTER_EMPTY);
|
||||
_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);
|
||||
|
@ -1039,6 +1039,11 @@ cons_roster_setting(void)
|
||||
else
|
||||
cons_show("Roster resource (/roster) : hide");
|
||||
|
||||
if (prefs_get_boolean(PREF_ROSTER_EMPTY))
|
||||
cons_show("Roster empty (/roster) : show");
|
||||
else
|
||||
cons_show("Roster empty (/roster) : hide");
|
||||
|
||||
char *by = prefs_get_string(PREF_ROSTER_BY);
|
||||
cons_show("Roster by (/roster) : %s", by);
|
||||
prefs_free_string(by);
|
||||
|
@ -84,11 +84,15 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
||||
static void
|
||||
_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char * const presence, char *title)
|
||||
{
|
||||
GSList *contacts = roster_get_contacts_by_presence(presence);
|
||||
|
||||
// if this group has contacts, or if we want to show empty groups
|
||||
if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
|
||||
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
win_printline_nowrap(layout->subwin, title);
|
||||
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
}
|
||||
|
||||
GSList *contacts = roster_get_contacts_by_presence(presence);
|
||||
if (contacts) {
|
||||
GSList *curr_contact = contacts;
|
||||
while (curr_contact) {
|
||||
|
Loading…
Reference in New Issue
Block a user