mirror of https://github.com/djcb/mu.git
parent
4daa7105d2
commit
90e35a9732
|
@ -35,8 +35,12 @@ AM_CFLAGS= \
|
||||||
-Wno-deprecated-declarations \
|
-Wno-deprecated-declarations \
|
||||||
-Wno-switch-enum
|
-Wno-switch-enum
|
||||||
|
|
||||||
AM_CXXFLAGS=$(WARN_CXXFLAGS)
|
AM_CXXFLAGS= \
|
||||||
|
$(WARN_CXXFLAGS) \
|
||||||
|
$(ASAN_CFLAGS) \
|
||||||
|
-Wno-redundant-decls \
|
||||||
|
-Wno-deprecated-declarations \
|
||||||
|
-Wno-switch-enum
|
||||||
#
|
#
|
||||||
# Distributors: this is a _toy_, not for distribution. the "noinst_" says enough
|
# Distributors: this is a _toy_, not for distribution. the "noinst_" says enough
|
||||||
#
|
#
|
||||||
|
@ -48,7 +52,7 @@ mug_SOURCES= \
|
||||||
mug-msg-list-view.cc \
|
mug-msg-list-view.cc \
|
||||||
mug-msg-list-view.h \
|
mug-msg-list-view.h \
|
||||||
mug-msg-view.h \
|
mug-msg-view.h \
|
||||||
mug-msg-view.c \
|
mug-msg-view.cc \
|
||||||
mug-query-bar.h \
|
mug-query-bar.h \
|
||||||
mug-query-bar.c \
|
mug-query-bar.c \
|
||||||
mug-shortcuts.cc \
|
mug-shortcuts.cc \
|
||||||
|
@ -70,14 +74,14 @@ noinst_LTLIBRARIES= \
|
||||||
libmuwidgets_la_SOURCES= \
|
libmuwidgets_la_SOURCES= \
|
||||||
mu-widget-util.h \
|
mu-widget-util.h \
|
||||||
mu-widget-util.c \
|
mu-widget-util.c \
|
||||||
mu-msg-attach-view.c \
|
mu-msg-attach-view.cc \
|
||||||
mu-msg-attach-view.h \
|
mu-msg-attach-view.hh \
|
||||||
mu-msg-body-view.c \
|
mu-msg-body-view.cc \
|
||||||
mu-msg-body-view.h \
|
mu-msg-body-view.hh \
|
||||||
mu-msg-header-view.c \
|
mu-msg-header-view.cc \
|
||||||
mu-msg-header-view.h \
|
mu-msg-header-view.hh \
|
||||||
mu-msg-view.h \
|
mu-msg-view.hh \
|
||||||
mu-msg-view.c
|
mu-msg-view.cc
|
||||||
|
|
||||||
libmuwidgets_la_LIBADD= \
|
libmuwidgets_la_LIBADD= \
|
||||||
${top_builddir}/lib/libmu.la \
|
${top_builddir}/lib/libmu.la \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -17,9 +17,12 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mu-msg-attach-view.h"
|
#include "mu-msg-attach-view.hh"
|
||||||
#include "mu-widget-util.h"
|
#include "mu-widget-util.h"
|
||||||
#include <mu-msg-part.h>
|
#include <mu-msg.hh>
|
||||||
|
#include <mu-msg-part.hh>
|
||||||
|
|
||||||
|
using namespace Mu;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ICON_COL,
|
ICON_COL,
|
||||||
|
@ -78,7 +81,7 @@ mu_msg_attach_view_class_init (MuMsgAttachViewClass *klass)
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
gobject_class = (GObjectClass*) klass;
|
gobject_class = (GObjectClass*) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = (GtkIconViewClass*)g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = mu_msg_attach_view_finalize;
|
gobject_class->finalize = mu_msg_attach_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof(MuMsgAttachViewPrivate));
|
g_type_class_add_private (gobject_class, sizeof(MuMsgAttachViewPrivate));
|
||||||
|
@ -204,7 +207,8 @@ mu_msg_attach_view_init (MuMsgAttachView *obj)
|
||||||
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW(obj),
|
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW(obj),
|
||||||
GTK_SELECTION_MULTIPLE);
|
GTK_SELECTION_MULTIPLE);
|
||||||
/* drag & drop */
|
/* drag & drop */
|
||||||
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW(obj), 0, NULL, 0,
|
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW(obj),
|
||||||
|
(GdkModifierType)0, NULL, 0,
|
||||||
GDK_ACTION_COPY);
|
GDK_ACTION_COPY);
|
||||||
gtk_drag_source_add_uri_targets(GTK_WIDGET(obj));
|
gtk_drag_source_add_uri_targets(GTK_WIDGET(obj));
|
||||||
g_signal_connect (obj, "drag-data-get", G_CALLBACK(on_drag_data_get), NULL);
|
g_signal_connect (obj, "drag-data-get", G_CALLBACK(on_drag_data_get), NULL);
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
#define __MU_MSG_ATTACH_VIEW_H__
|
#define __MU_MSG_ATTACH_VIEW_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <mu-msg.h>
|
#include <mu-msg.hh>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct _MuMsgAttachView {
|
||||||
struct _MuMsgAttachViewClass {
|
struct _MuMsgAttachViewClass {
|
||||||
GtkIconViewClass parent_class;
|
GtkIconViewClass parent_class;
|
||||||
void (* attach_activated) (MuMsgAttachView* obj, guint partnum,
|
void (* attach_activated) (MuMsgAttachView* obj, guint partnum,
|
||||||
MuMsg *msg);
|
Mu::MuMsg *msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* member functions */
|
/* member functions */
|
||||||
|
@ -60,7 +60,7 @@ GType mu_msg_attach_view_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget* mu_msg_attach_view_new (void);
|
GtkWidget* mu_msg_attach_view_new (void);
|
||||||
|
|
||||||
/* returns # of attachments */
|
/* returns # of attachments */
|
||||||
int mu_msg_attach_view_set_message (MuMsgAttachView *self, MuMsg *msg);
|
int mu_msg_attach_view_set_message (MuMsgAttachView *self, Mu::MuMsg *msg);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -17,8 +17,10 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mu-msg-body-view.h"
|
#include "mu-msg-body-view.hh"
|
||||||
#include <mu-msg-part.h>
|
#include <mu-msg-part.hh>
|
||||||
|
|
||||||
|
using namespace Mu;
|
||||||
|
|
||||||
enum _ViewMode {
|
enum _ViewMode {
|
||||||
VIEW_MODE_MSG,
|
VIEW_MODE_MSG,
|
||||||
|
@ -79,7 +81,7 @@ mu_msg_body_view_class_init (MuMsgBodyViewClass *klass)
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
gobject_class = (GObjectClass*) klass;
|
gobject_class = (GObjectClass*) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = (WebKitWebViewClass*)g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = mu_msg_body_view_finalize;
|
gobject_class->finalize = mu_msg_body_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof(MuMsgBodyViewPrivate));
|
g_type_class_add_private (gobject_class, sizeof(MuMsgBodyViewPrivate));
|
|
@ -21,7 +21,7 @@
|
||||||
#define __MU_MSG_BODY_VIEW_H__
|
#define __MU_MSG_BODY_VIEW_H__
|
||||||
|
|
||||||
#include <webkit2/webkit2.h>
|
#include <webkit2/webkit2.h>
|
||||||
#include <mu-msg.h>
|
#include <mu-msg.hh>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -60,9 +60,9 @@ GType mu_msg_body_view_get_type (void) G_GNUC_CONST;
|
||||||
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
||||||
GtkWidget* mu_msg_body_view_new (void);
|
GtkWidget* mu_msg_body_view_new (void);
|
||||||
|
|
||||||
void mu_msg_body_view_set_message (MuMsgBodyView *self, MuMsg *msg);
|
void mu_msg_body_view_set_message (MuMsgBodyView *self, Mu::MuMsg *msg);
|
||||||
void mu_msg_body_view_set_note (MuMsgBodyView *self, const gchar *html);
|
void mu_msg_body_view_set_note (MuMsgBodyView *self, const gchar *html);
|
||||||
void mu_msg_body_view_set_message_source (MuMsgBodyView *self, MuMsg *msg);
|
void mu_msg_body_view_set_message_source (MuMsgBodyView *self, Mu::MuMsg *msg);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -16,15 +16,14 @@
|
||||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
#include <config.h>
|
||||||
#include "mu-msg-header-view.h"
|
#include "mu-msg-header-view.hh"
|
||||||
|
#include "mu-msg.hh"
|
||||||
|
|
||||||
#include <utils/mu-str.h>
|
#include <utils/mu-str.h>
|
||||||
#include <utils/mu-date.h>
|
#include <utils/mu-date.h>
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
using namespace Mu;
|
||||||
#include <config.h>
|
|
||||||
#endif /*HAVE_CONFIG_H*/
|
|
||||||
|
|
||||||
/* 'private'/'protected' functions */
|
/* 'private'/'protected' functions */
|
||||||
static void mu_msg_header_view_class_init (MuMsgHeaderViewClass *klass);
|
static void mu_msg_header_view_class_init (MuMsgHeaderViewClass *klass);
|
||||||
|
@ -59,7 +58,7 @@ mu_msg_header_view_class_init (MuMsgHeaderViewClass *klass)
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
gobject_class = (GObjectClass*) klass;
|
gobject_class = (GObjectClass*) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = (GtkBoxClass*)g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = mu_msg_header_view_finalize;
|
gobject_class->finalize = mu_msg_header_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof(MuMsgHeaderViewPrivate));
|
g_type_class_add_private (gobject_class, sizeof(MuMsgHeaderViewPrivate));
|
||||||
|
@ -115,7 +114,7 @@ get_label (const gchar *txt, gboolean istitle)
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
G_GNUC_UNUSED static gboolean
|
||||||
add_row (GtkWidget *grid, guint row, const char* fieldname, const char *value,
|
add_row (GtkWidget *grid, guint row, const char* fieldname, const char *value,
|
||||||
gboolean showempty)
|
gboolean showempty)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +142,7 @@ add_row (GtkWidget *grid, guint row, const char* fieldname, const char *value,
|
||||||
|
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
get_grid (MuMsg *msg)
|
get_grid (Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
int row;
|
int row;
|
||||||
|
@ -170,7 +169,7 @@ get_grid (MuMsg *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mu_msg_header_view_set_message (MuMsgHeaderView *self, MuMsg *msg)
|
mu_msg_header_view_set_message (MuMsgHeaderView *self, Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
g_return_if_fail (MU_IS_MSG_HEADER_VIEW(self));
|
g_return_if_fail (MU_IS_MSG_HEADER_VIEW(self));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -21,11 +21,7 @@
|
||||||
#define __MU_MSG_HEADER_VIEW_H__
|
#define __MU_MSG_HEADER_VIEW_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <mu-msg.h>
|
#include <mu-msg.hh>
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif /*HAVE_CONFIG_H*/
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -61,7 +57,8 @@ GType mu_msg_header_view_get_type (void) G_GNUC_CONST;
|
||||||
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
||||||
GtkWidget* mu_msg_header_view_new (void);
|
GtkWidget* mu_msg_header_view_new (void);
|
||||||
|
|
||||||
void mu_msg_header_view_set_message (MuMsgHeaderView *self, MuMsg *msg);
|
struct MuMsg;
|
||||||
|
void mu_msg_header_view_set_message (MuMsgHeaderView *self, Mu::MuMsg *msg);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -17,16 +17,18 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif /*HAVE_CONFIG_H*/
|
|
||||||
|
|
||||||
#include "mu-msg-view.h"
|
#include "mu-msg-view.hh"
|
||||||
#include "mu-msg-body-view.h"
|
#include "mu-msg-body-view.hh"
|
||||||
#include "mu-msg-header-view.h"
|
#include "mu-msg-header-view.hh"
|
||||||
#include "mu-msg-attach-view.h"
|
#include "mu-msg-attach-view.hh"
|
||||||
#include <mu-msg-part.h>
|
#include <utils/mu-util.h>
|
||||||
|
|
||||||
|
#include <mu-msg.hh>
|
||||||
|
#include <mu-msg-part.hh>
|
||||||
|
|
||||||
|
using namespace Mu;
|
||||||
|
|
||||||
/* 'private'/'protected' functions */
|
/* 'private'/'protected' functions */
|
||||||
static void mu_msg_view_class_init (MuMsgViewClass *klass);
|
static void mu_msg_view_class_init (MuMsgViewClass *klass);
|
||||||
|
@ -42,7 +44,7 @@ enum {
|
||||||
|
|
||||||
struct _MuMsgViewPrivate {
|
struct _MuMsgViewPrivate {
|
||||||
GtkWidget *_headers, *_attach, *_attachexpander, *_body;
|
GtkWidget *_headers, *_attach, *_attachexpander, *_body;
|
||||||
MuMsg *_msg;
|
Mu::MuMsg *_msg;
|
||||||
};
|
};
|
||||||
#define MU_MSG_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
|
#define MU_MSG_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
|
||||||
MU_TYPE_MSG_VIEW, \
|
MU_TYPE_MSG_VIEW, \
|
||||||
|
@ -56,7 +58,7 @@ static GtkBoxClass *parent_class = NULL;
|
||||||
G_DEFINE_TYPE (MuMsgView, mu_msg_view, GTK_TYPE_BOX);
|
G_DEFINE_TYPE (MuMsgView, mu_msg_view, GTK_TYPE_BOX);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_message (MuMsgView *self, MuMsg *msg)
|
set_message (MuMsgView *self, Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
if (self->_priv->_msg == msg)
|
if (self->_priv->_msg == msg)
|
||||||
return; /* nothing to todo */
|
return; /* nothing to todo */
|
||||||
|
@ -77,7 +79,7 @@ mu_msg_view_class_init (MuMsgViewClass *klass)
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
gobject_class = (GObjectClass*) klass;
|
gobject_class = (GObjectClass*) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = (GtkBoxClass*)g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = mu_msg_view_finalize;
|
gobject_class->finalize = mu_msg_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof(MuMsgViewPrivate));
|
g_type_class_add_private (gobject_class, sizeof(MuMsgViewPrivate));
|
||||||
|
@ -110,7 +112,7 @@ on_body_action_requested (GtkWidget *w, const char* action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_attach_activated (GtkWidget *w, guint partnum, MuMsg *msg)
|
on_attach_activated (GtkWidget *w, guint partnum, Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
gchar *filepath;
|
gchar *filepath;
|
||||||
GError *err;
|
GError *err;
|
||||||
|
@ -188,7 +190,7 @@ mu_msg_view_new (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
mu_msg_view_set_message (MuMsgView *self, Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
gint attachnum;
|
gint attachnum;
|
||||||
|
|
||||||
|
@ -212,7 +214,8 @@ mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mu_msg_view_set_message_source (MuMsgView *self, MuMsg *msg)
|
mu_msg_view_set_message_source (MuMsgView *self,
|
||||||
|
Mu::MuMsg *msg)
|
||||||
{
|
{
|
||||||
g_return_if_fail (MU_IS_MSG_VIEW(self));
|
g_return_if_fail (MU_IS_MSG_VIEW(self));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2011-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2011-2020Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -21,11 +21,7 @@
|
||||||
#define __MU_MSG_VIEW_H__
|
#define __MU_MSG_VIEW_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <mu-msg.h>
|
#include "mu-msg.hh"
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif /*HAVE_CONFIG_H*/
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -59,9 +55,11 @@ GType mu_msg_view_get_type (void) G_GNUC_CONST;
|
||||||
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */
|
||||||
GtkWidget* mu_msg_view_new (void);
|
GtkWidget* mu_msg_view_new (void);
|
||||||
|
|
||||||
void mu_msg_view_set_message (MuMsgView *self, MuMsg *msg);
|
struct MuMsg;
|
||||||
|
|
||||||
|
void mu_msg_view_set_message (MuMsgView *self, Mu::MuMsg *msg);
|
||||||
void mu_msg_view_set_note (MuMsgView *self, const gchar* html);
|
void mu_msg_view_set_note (MuMsgView *self, const gchar* html);
|
||||||
void mu_msg_view_set_message_source (MuMsgView *self, MuMsg *msg);
|
void mu_msg_view_set_message_source (MuMsgView *self, Mu::MuMsg *msg);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
/**
|
/**
|
||||||
* get a pixbuf (icon) for a certain content-type (ie., 'image/jpeg')
|
* get a pixbuf (icon) for a certain content-type (ie., 'image/jpeg')
|
||||||
*
|
*
|
||||||
|
@ -36,4 +37,6 @@ GdkPixbuf* mu_widget_util_get_icon_pixbuf_for_content_type (const char *ctype,
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /*__MU_WIDGET_UTIL_H__*/
|
#endif /*__MU_WIDGET_UTIL_H__*/
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#include "mu-query.hh"
|
#include "mu-query.hh"
|
||||||
#include "utils/mu-str.h"
|
#include "utils/mu-str.h"
|
||||||
#include "utils/mu-date.h"
|
#include "utils/mu-date.h"
|
||||||
#include "mu-threader.hh"
|
|
||||||
|
using namespace Mu;
|
||||||
|
|
||||||
/* 'private'/'protected' functions */
|
/* 'private'/'protected' functions */
|
||||||
static void mug_msg_list_view_finalize (GObject * obj);
|
static void mug_msg_list_view_finalize (GObject * obj);
|
||||||
|
@ -302,20 +303,18 @@ empty_or_display_contact (const gchar * str)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MuMsgIter *
|
static Mu::Option<Mu::QueryResults>
|
||||||
run_query (const char *xpath, const char *expr, MugMsgListView * self) try
|
run_query (const char *xpath, const char *expr, MugMsgListView * self)
|
||||||
{
|
{
|
||||||
Mu::Store store{xpath};
|
Mu::Store store{xpath};
|
||||||
Mu::Query query{store};
|
Mu::Query query{store};
|
||||||
|
|
||||||
return query.run(expr, MU_MSG_FIELD_ID_DATE,
|
return query.run(expr, MU_MSG_FIELD_ID_DATE,
|
||||||
Mu::Query::Flags::Descending |
|
Mu::QueryFlags::Descending |
|
||||||
Mu::Query::Flags::SkipUnreadable |
|
Mu::QueryFlags::SkipUnreadable |
|
||||||
Mu::Query::Flags::SkipDups |
|
Mu::QueryFlags::SkipDuplicates |
|
||||||
Mu::Query::Flags::IncludeRelated |
|
Mu::QueryFlags::IncludeRelated |
|
||||||
Mu::Query::Flags::Threading);
|
Mu::QueryFlags::Threading);
|
||||||
} catch (...) {
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -358,39 +357,34 @@ static int
|
||||||
update_model (GtkTreeStore *store, const char *xpath, const char *query,
|
update_model (GtkTreeStore *store, const char *xpath, const char *query,
|
||||||
MugMsgListView *self)
|
MugMsgListView *self)
|
||||||
{
|
{
|
||||||
MuMsgIter *iter;
|
const auto res{run_query (xpath, query, self)};
|
||||||
int count;
|
if (!res) {
|
||||||
const MuMsgIterThreadInfo *prev_ti = NULL;
|
g_warning ("error: running query failed");
|
||||||
|
|
||||||
iter = run_query (xpath, query, self);
|
|
||||||
if (!iter) {
|
|
||||||
g_warning ("error: running query failed\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; !mu_msg_iter_is_done (iter);
|
auto count{0};
|
||||||
mu_msg_iter_next (iter), ++count) {
|
|
||||||
|
|
||||||
|
std::string prev_thread_path;
|
||||||
|
for (auto&& it: *res) {
|
||||||
GtkTreeIter treeiter, prev_treeiter;
|
GtkTreeIter treeiter, prev_treeiter;
|
||||||
const MuMsgIterThreadInfo *ti;
|
|
||||||
|
|
||||||
ti = mu_msg_iter_get_thread_info (iter);
|
const auto thread_path{it.query_match().thread_path};
|
||||||
|
|
||||||
if (!prev_ti || !g_str_has_prefix (ti->threadpath,
|
if (prev_thread_path.find(thread_path) == 0)
|
||||||
prev_ti->threadpath))
|
|
||||||
gtk_tree_store_append (store, &treeiter, NULL);
|
|
||||||
else
|
|
||||||
gtk_tree_store_append (store, &treeiter, &prev_treeiter);
|
gtk_tree_store_append (store, &treeiter, &prev_treeiter);
|
||||||
|
else
|
||||||
|
gtk_tree_store_append (store, &treeiter, NULL);
|
||||||
|
|
||||||
/* don't unref msg */
|
/* don't unref msg */
|
||||||
add_row (store, mu_msg_iter_get_msg_floating (iter), &treeiter);
|
add_row (store, it.floating_msg(), &treeiter);
|
||||||
|
|
||||||
prev_ti = ti;
|
//prev_ti = ti;
|
||||||
prev_treeiter = treeiter;
|
prev_treeiter = treeiter;
|
||||||
|
prev_thread_path = thread_path;
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
mu_msg_iter_destroy (iter);
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
|
@ -16,16 +16,16 @@
|
||||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CONFIG
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif /*HAVE_CONFIG*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "mu-msg-view.h"
|
#include "mu-msg-view.hh"
|
||||||
#include "mug-msg-view.h"
|
#include "mug-msg-view.h"
|
||||||
#include "mu-msg.h"
|
#include "mu-msg.hh"
|
||||||
#include "utils/mu-str.h"
|
#include "utils/mu-str.h"
|
||||||
|
|
||||||
|
using namespace Mu;
|
||||||
|
|
||||||
/* 'private'/'protected' functions */
|
/* 'private'/'protected' functions */
|
||||||
static void mug_msg_view_class_init (MugMsgViewClass * klass);
|
static void mug_msg_view_class_init (MugMsgViewClass * klass);
|
||||||
static void mug_msg_view_init (MugMsgView * obj);
|
static void mug_msg_view_init (MugMsgView * obj);
|
||||||
|
@ -58,7 +58,7 @@ mug_msg_view_class_init (MugMsgViewClass * klass)
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = (GtkBoxClass*)g_type_class_peek_parent (klass);
|
||||||
gobject_class->finalize = mug_msg_view_finalize;
|
gobject_class->finalize = mug_msg_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (MugMsgViewPrivate));
|
g_type_class_add_private (gobject_class, sizeof (MugMsgViewPrivate));
|
||||||
|
@ -116,7 +116,7 @@ mug_msg_view_set_msg (MugMsgView * self, const char *msgpath)
|
||||||
if (!msgpath)
|
if (!msgpath)
|
||||||
mu_msg_view_set_message (MU_MSG_VIEW(priv->_view), NULL);
|
mu_msg_view_set_message (MU_MSG_VIEW(priv->_view), NULL);
|
||||||
else {
|
else {
|
||||||
MuMsg *msg;
|
Mu::MuMsg *msg;
|
||||||
|
|
||||||
if (access (msgpath, R_OK) == 0) {
|
if (access (msgpath, R_OK) == 0) {
|
||||||
msg = mu_msg_new_from_file (msgpath, NULL, NULL);
|
msg = mu_msg_new_from_file (msgpath, NULL, NULL);
|
Loading…
Reference in New Issue