* mu-msg-prio: some coding updates

This commit is contained in:
Dirk-Jan C. Binnema 2010-11-21 15:43:11 +02:00
parent 29ed5fbcf3
commit 04305eadaa
2 changed files with 11 additions and 18 deletions

View File

@ -34,23 +34,17 @@ mu_msg_prio_name (MuMsgPrio prio)
MuMsgPrio MuMsgPrio
mu_msg_prio_from_char (char k) mu_msg_prio_from_char (char k)
{ {
switch (k) { g_return_val_if_fail (k == 'l' || k == 'n' || k == 'h',
case 'l': return MU_MSG_PRIO_LOW; MU_MSG_PRIO_NONE);
case 'n': return MU_MSG_PRIO_NORMAL; return (MuMsgPrio)k;
case 'h': return MU_MSG_PRIO_HIGH;
default: g_return_val_if_reached (MU_MSG_PRIO_NONE);
}
} }
char char
mu_msg_prio_to_char (MuMsgPrio prio) mu_msg_prio_char (MuMsgPrio prio)
{ {
switch (prio) { g_return_val_if_fail (prio == 'l' || prio == 'n' || prio == 'h',
case MU_MSG_PRIO_LOW : return 'l'; 0);
case MU_MSG_PRIO_NORMAL : return 'n'; return (char)prio;
case MU_MSG_PRIO_HIGH : return 'h';
default : g_return_val_if_reached (0);
}
} }

View File

@ -25,9 +25,9 @@
G_BEGIN_DECLS G_BEGIN_DECLS
enum _MuMsgPrio { enum _MuMsgPrio {
MU_MSG_PRIO_LOW, MU_MSG_PRIO_LOW = 'l',
MU_MSG_PRIO_NORMAL, MU_MSG_PRIO_NORMAL = 'n',
MU_MSG_PRIO_HIGH MU_MSG_PRIO_HIGH = 'h'
}; };
typedef enum _MuMsgPrio MuMsgPrio; typedef enum _MuMsgPrio MuMsgPrio;
@ -66,8 +66,7 @@ MuMsgPrio mu_msg_prio_from_char (char k) G_GNUC_CONST;
* *
* @return a shortcut character or 0 in case of error * @return a shortcut character or 0 in case of error
*/ */
char mu_msg_prio_to_char (MuMsgPrio prio) G_GNUC_CONST; char mu_msg_prio_char (MuMsgPrio prio) G_GNUC_CONST;
typedef void (*MuMsgPrioForeachFunc) (MuMsgPrio prio, gpointer user_data); typedef void (*MuMsgPrioForeachFunc) (MuMsgPrio prio, gpointer user_data);
/** /**