* use new mu-widget features in mug-msg-view

This commit is contained in:
Dirk-Jan C. Binnema 2011-01-12 23:16:19 +02:00
parent e048b9607f
commit 4d82a4e7c7
2 changed files with 24 additions and 5 deletions

View File

@ -119,11 +119,24 @@ mug_msg_view_set_msg (MugMsgView * self, const char *msgpath)
else {
MuMsg *msg;
msg = mu_msg_new (msgpath, NULL, NULL);
mu_msg_view_set_message (MU_MSG_VIEW(priv->_view), msg);
if (msg)
mu_msg_unref (msg);
if (access (msgpath, R_OK) == 0) {
msg = mu_msg_new (msgpath, NULL, NULL);
mu_msg_view_set_message (MU_MSG_VIEW(priv->_view), msg);
if (msg)
mu_msg_unref (msg);
} else {
gchar *note;
note = g_strdup_printf (
"<h1>Note</h1><hr>"
"<p>Message <tt>%s</tt> does not seem to be present "
"on the file system."
"<p>Maybe you need to run <tt>mu index</tt>?"
"<p>Click <a href=\"cmd:index\">here</a> to start the index"
,
msgpath);
mu_msg_view_set_note (MU_MSG_VIEW (priv->_view), note);
g_free (note);
}
}
return TRUE;

View File

@ -63,6 +63,7 @@ about_mug (MugData * mugdata)
enum _ToolAction {
ACTION_PREV_MSG = 1,
ACTION_NEXT_MSG,
ACTION_REINDEX,
ACTION_DO_QUIT,
ACTION_ABOUT,
ACTION_SEPARATOR /* pseudo action */
@ -88,6 +89,9 @@ on_tool_button_clicked (GtkToolButton * btn, MugData * mugdata)
mug_msg_list_view_move_prev (MUG_MSG_LIST_VIEW
(mugdata->mlist));
break;
case ACTION_REINDEX:
g_print ("Reindex!\n");
break;
case ACTION_ABOUT:
about_mug (mugdata);
break;
@ -123,6 +127,8 @@ mug_toolbar (MugData * mugdata)
{GTK_STOCK_GO_UP, ACTION_PREV_MSG},
{GTK_STOCK_GO_DOWN, ACTION_NEXT_MSG},
{NULL, ACTION_SEPARATOR},
{GTK_STOCK_REFRESH, ACTION_REINDEX},
{NULL, ACTION_SEPARATOR},
{GTK_STOCK_ABOUT, ACTION_ABOUT},
{NULL, ACTION_SEPARATOR},
{GTK_STOCK_QUIT, ACTION_DO_QUIT}};