2010-11-21 12:36:22 +01:00
|
|
|
/*
|
2017-10-24 21:57:57 +02:00
|
|
|
** Copyright (C) 2012-2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
2010-11-21 12:36:22 +01:00
|
|
|
**
|
|
|
|
** This program is free software; you can redistribute it and/or modify it
|
|
|
|
** under the terms of the GNU General Public License as published by the
|
|
|
|
** Free Software Foundation; either version 3, or (at your option) any
|
|
|
|
** later version.
|
|
|
|
**
|
|
|
|
** This program is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with this program; if not, write to the Free Software Foundation,
|
|
|
|
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mu-msg-prio.h"
|
|
|
|
|
|
|
|
|
2017-10-24 21:57:57 +02:00
|
|
|
const char*
|
2010-11-21 12:36:22 +01:00
|
|
|
mu_msg_prio_name (MuMsgPrio prio)
|
|
|
|
{
|
|
|
|
switch (prio) {
|
|
|
|
case MU_MSG_PRIO_LOW : return "low";
|
|
|
|
case MU_MSG_PRIO_NORMAL : return "normal";
|
|
|
|
case MU_MSG_PRIO_HIGH : return "high";
|
|
|
|
default : g_return_val_if_reached (NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MuMsgPrio
|
|
|
|
mu_msg_prio_from_char (char k)
|
|
|
|
{
|
2010-11-21 14:43:11 +01:00
|
|
|
g_return_val_if_fail (k == 'l' || k == 'n' || k == 'h',
|
|
|
|
MU_MSG_PRIO_NONE);
|
|
|
|
return (MuMsgPrio)k;
|
2010-11-21 12:36:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
char
|
2010-11-21 14:43:11 +01:00
|
|
|
mu_msg_prio_char (MuMsgPrio prio)
|
2010-11-21 12:36:22 +01:00
|
|
|
{
|
2011-05-09 01:58:33 +02:00
|
|
|
if (!(prio == 'l' || prio == 'n' || prio == 'h')) {
|
|
|
|
g_warning ("prio: %c", (char)prio);
|
|
|
|
}
|
2017-10-24 21:57:57 +02:00
|
|
|
|
|
|
|
|
2010-11-21 14:43:11 +01:00
|
|
|
g_return_val_if_fail (prio == 'l' || prio == 'n' || prio == 'h',
|
|
|
|
0);
|
2011-05-19 06:32:09 +02:00
|
|
|
|
2010-11-21 14:43:11 +01:00
|
|
|
return (char)prio;
|
2010-11-21 12:36:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
mu_msg_prio_foreach (MuMsgPrioForeachFunc func, gpointer user_data)
|
|
|
|
{
|
|
|
|
g_return_if_fail (func);
|
|
|
|
|
|
|
|
func (MU_MSG_PRIO_LOW, user_data);
|
|
|
|
func (MU_MSG_PRIO_NORMAL, user_data);
|
|
|
|
func (MU_MSG_PRIO_HIGH, user_data);
|
|
|
|
}
|