mirror of https://github.com/djcb/mu.git
parent
4daa7105d2
commit
90e35a9732
|
@ -30,13 +30,17 @@ AM_CPPFLAGS=-I${top_srcdir} -I${top_srcdir}/lib $(GTK_CFLAGS) $(WEBKIT_CFLAGS) \
|
|||
# really need all the params they get
|
||||
AM_CFLAGS= \
|
||||
$(WARN_CFLAGS) \
|
||||
$(ASAN_CFLAGS) \
|
||||
$(ASAN_CFLAGS) \
|
||||
-Wno-redundant-decls \
|
||||
-Wno-deprecated-declarations \
|
||||
-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
|
||||
#
|
||||
|
@ -48,7 +52,7 @@ mug_SOURCES= \
|
|||
mug-msg-list-view.cc \
|
||||
mug-msg-list-view.h \
|
||||
mug-msg-view.h \
|
||||
mug-msg-view.c \
|
||||
mug-msg-view.cc \
|
||||
mug-query-bar.h \
|
||||
mug-query-bar.c \
|
||||
mug-shortcuts.cc \
|
||||
|
@ -70,14 +74,14 @@ noinst_LTLIBRARIES= \
|
|||
libmuwidgets_la_SOURCES= \
|
||||
mu-widget-util.h \
|
||||
mu-widget-util.c \
|
||||
mu-msg-attach-view.c \
|
||||
mu-msg-attach-view.h \
|
||||
mu-msg-body-view.c \
|
||||
mu-msg-body-view.h \
|
||||
mu-msg-header-view.c \
|
||||
mu-msg-header-view.h \
|
||||
mu-msg-view.h \
|
||||
mu-msg-view.c
|
||||
mu-msg-attach-view.cc \
|
||||
mu-msg-attach-view.hh \
|
||||
mu-msg-body-view.cc \
|
||||
mu-msg-body-view.hh \
|
||||
mu-msg-header-view.cc \
|
||||
mu-msg-header-view.hh \
|
||||
mu-msg-view.hh \
|
||||
mu-msg-view.cc
|
||||
|
||||
libmuwidgets_la_LIBADD= \
|
||||
${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
|
||||
** 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-msg-part.h>
|
||||
#include <mu-msg.hh>
|
||||
#include <mu-msg-part.hh>
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
enum {
|
||||
ICON_COL,
|
||||
|
@ -78,7 +81,7 @@ mu_msg_attach_view_class_init (MuMsgAttachViewClass *klass)
|
|||
GObjectClass *gobject_class;
|
||||
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;
|
||||
|
||||
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_SELECTION_MULTIPLE);
|
||||
/* 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);
|
||||
gtk_drag_source_add_uri_targets(GTK_WIDGET(obj));
|
||||
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
|
||||
** under the terms of the GNU General Public License as published by the
|
||||
|
@ -22,7 +22,7 @@
|
|||
#define __MU_MSG_ATTACH_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-msg.h>
|
||||
#include <mu-msg.hh>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -49,7 +49,7 @@ struct _MuMsgAttachView {
|
|||
struct _MuMsgAttachViewClass {
|
||||
GtkIconViewClass parent_class;
|
||||
void (* attach_activated) (MuMsgAttachView* obj, guint partnum,
|
||||
MuMsg *msg);
|
||||
Mu::MuMsg *msg);
|
||||
};
|
||||
|
||||
/* member functions */
|
||||
|
@ -60,7 +60,7 @@ GType mu_msg_attach_view_get_type (void) G_GNUC_CONST;
|
|||
GtkWidget* mu_msg_attach_view_new (void);
|
||||
|
||||
/* 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
|
||||
|
|
@ -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
|
||||
** 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-part.h>
|
||||
#include "mu-msg-body-view.hh"
|
||||
#include <mu-msg-part.hh>
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
enum _ViewMode {
|
||||
VIEW_MODE_MSG,
|
||||
|
@ -79,7 +81,7 @@ mu_msg_body_view_class_init (MuMsgBodyViewClass *klass)
|
|||
GObjectClass *gobject_class;
|
||||
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;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof(MuMsgBodyViewPrivate));
|
|
@ -21,7 +21,7 @@
|
|||
#define __MU_MSG_BODY_VIEW_H__
|
||||
|
||||
#include <webkit2/webkit2.h>
|
||||
#include <mu-msg.h>
|
||||
#include <mu-msg.hh>
|
||||
|
||||
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* */
|
||||
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_message_source (MuMsgBodyView *self, MuMsg *msg);
|
||||
void mu_msg_body_view_set_message_source (MuMsgBodyView *self, Mu::MuMsg *msg);
|
||||
|
||||
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
|
||||
** 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.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "mu-msg-header-view.h"
|
||||
#include <config.h>
|
||||
#include "mu-msg-header-view.hh"
|
||||
#include "mu-msg.hh"
|
||||
|
||||
#include <utils/mu-str.h>
|
||||
#include <utils/mu-date.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
using namespace Mu;
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
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;
|
||||
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;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof(MuMsgHeaderViewPrivate));
|
||||
|
@ -115,7 +114,7 @@ get_label (const gchar *txt, gboolean istitle)
|
|||
return label;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
G_GNUC_UNUSED static gboolean
|
||||
add_row (GtkWidget *grid, guint row, const char* fieldname, const char *value,
|
||||
gboolean showempty)
|
||||
{
|
||||
|
@ -143,7 +142,7 @@ add_row (GtkWidget *grid, guint row, const char* fieldname, const char *value,
|
|||
|
||||
|
||||
static GtkWidget*
|
||||
get_grid (MuMsg *msg)
|
||||
get_grid (Mu::MuMsg *msg)
|
||||
{
|
||||
GtkWidget *grid;
|
||||
int row;
|
||||
|
@ -170,7 +169,7 @@ get_grid (MuMsg *msg)
|
|||
}
|
||||
|
||||
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));
|
||||
|
|
@ -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
|
||||
** under the terms of the GNU General Public License as published by the
|
||||
|
@ -21,11 +21,7 @@
|
|||
#define __MU_MSG_HEADER_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <mu-msg.hh>
|
||||
|
||||
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* */
|
||||
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
|
|
@ -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
|
||||
** under the terms of the GNU General Public License as published by the
|
||||
|
@ -17,16 +17,18 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include "mu-msg-view.h"
|
||||
#include "mu-msg-body-view.h"
|
||||
#include "mu-msg-header-view.h"
|
||||
#include "mu-msg-attach-view.h"
|
||||
#include <mu-msg-part.h>
|
||||
#include "mu-msg-view.hh"
|
||||
#include "mu-msg-body-view.hh"
|
||||
#include "mu-msg-header-view.hh"
|
||||
#include "mu-msg-attach-view.hh"
|
||||
#include <utils/mu-util.h>
|
||||
|
||||
#include <mu-msg.hh>
|
||||
#include <mu-msg-part.hh>
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mu_msg_view_class_init (MuMsgViewClass *klass);
|
||||
|
@ -42,7 +44,7 @@ enum {
|
|||
|
||||
struct _MuMsgViewPrivate {
|
||||
GtkWidget *_headers, *_attach, *_attachexpander, *_body;
|
||||
MuMsg *_msg;
|
||||
Mu::MuMsg *_msg;
|
||||
};
|
||||
#define MU_MSG_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
|
||||
MU_TYPE_MSG_VIEW, \
|
||||
|
@ -56,7 +58,7 @@ static GtkBoxClass *parent_class = NULL;
|
|||
G_DEFINE_TYPE (MuMsgView, mu_msg_view, GTK_TYPE_BOX);
|
||||
|
||||
static void
|
||||
set_message (MuMsgView *self, MuMsg *msg)
|
||||
set_message (MuMsgView *self, Mu::MuMsg *msg)
|
||||
{
|
||||
if (self->_priv->_msg == msg)
|
||||
return; /* nothing to todo */
|
||||
|
@ -77,7 +79,7 @@ mu_msg_view_class_init (MuMsgViewClass *klass)
|
|||
GObjectClass *gobject_class;
|
||||
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;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof(MuMsgViewPrivate));
|
||||
|
@ -110,7 +112,7 @@ on_body_action_requested (GtkWidget *w, const char* action,
|
|||
}
|
||||
|
||||
static void
|
||||
on_attach_activated (GtkWidget *w, guint partnum, MuMsg *msg)
|
||||
on_attach_activated (GtkWidget *w, guint partnum, Mu::MuMsg *msg)
|
||||
{
|
||||
gchar *filepath;
|
||||
GError *err;
|
||||
|
@ -188,7 +190,7 @@ mu_msg_view_new (void)
|
|||
}
|
||||
|
||||
void
|
||||
mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
||||
mu_msg_view_set_message (MuMsgView *self, Mu::MuMsg *msg)
|
||||
{
|
||||
gint attachnum;
|
||||
|
||||
|
@ -212,7 +214,8 @@ mu_msg_view_set_message (MuMsgView *self, MuMsg *msg)
|
|||
|
||||
|
||||
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));
|
||||
|
|
@ -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
|
||||
** under the terms of the GNU General Public License as published by the
|
||||
|
@ -21,11 +21,7 @@
|
|||
#define __MU_MSG_VIEW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include "mu-msg.hh"
|
||||
|
||||
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* */
|
||||
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_message_source (MuMsgView *self, MuMsg *msg);
|
||||
void mu_msg_view_set_message_source (MuMsgView *self, Mu::MuMsg *msg);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -22,12 +22,13 @@
|
|||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
/**
|
||||
G_BEGIN_DECLS
|
||||
/**
|
||||
* get a pixbuf (icon) for a certain content-type (ie., 'image/jpeg')
|
||||
*
|
||||
*
|
||||
* @param ctype the content-type (MIME-type)
|
||||
* @param size the size of the icon
|
||||
*
|
||||
*
|
||||
* @return a new GdkPixbuf, or NULL in case of error. Use
|
||||
* g_object_unref when the pixbuf is no longer needed.
|
||||
*/
|
||||
|
@ -36,4 +37,6 @@ GdkPixbuf* mu_widget_util_get_icon_pixbuf_for_content_type (const char *ctype,
|
|||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_WIDGET_UTIL_H__*/
|
||||
|
|
|
@ -21,37 +21,38 @@
|
|||
#include "mu-query.hh"
|
||||
#include "utils/mu-str.h"
|
||||
#include "utils/mu-date.h"
|
||||
#include "mu-threader.hh"
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mug_msg_list_view_finalize (GObject * obj);
|
||||
|
||||
/* list my signals */
|
||||
enum {
|
||||
MUG_MSG_SELECTED,
|
||||
MUG_ERROR_OCCURED,
|
||||
LAST_SIGNAL
|
||||
MUG_MSG_SELECTED,
|
||||
MUG_ERROR_OCCURED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
MUG_COL_DATESTR,
|
||||
MUG_COL_MAILDIR,
|
||||
MUG_COL_FLAGSSTR,
|
||||
MUG_COL_FROM,
|
||||
MUG_COL_TO,
|
||||
MUG_COL_SUBJECT,
|
||||
MUG_COL_PATH,
|
||||
MUG_COL_PRIO,
|
||||
MUG_COL_FLAGS,
|
||||
MUG_COL_TIME,
|
||||
MUG_N_COLS
|
||||
MUG_COL_DATESTR,
|
||||
MUG_COL_MAILDIR,
|
||||
MUG_COL_FLAGSSTR,
|
||||
MUG_COL_FROM,
|
||||
MUG_COL_TO,
|
||||
MUG_COL_SUBJECT,
|
||||
MUG_COL_PATH,
|
||||
MUG_COL_PRIO,
|
||||
MUG_COL_FLAGS,
|
||||
MUG_COL_TIME,
|
||||
MUG_N_COLS
|
||||
};
|
||||
|
||||
typedef struct _MugMsgListViewPrivate MugMsgListViewPrivate;
|
||||
struct _MugMsgListViewPrivate {
|
||||
GtkTreeStore *_store;
|
||||
char *_xpath;
|
||||
char *_query;
|
||||
GtkTreeStore *_store;
|
||||
char *_xpath;
|
||||
char *_query;
|
||||
};
|
||||
#define MUG_MSG_LIST_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
|
||||
MUG_TYPE_MSG_LIST_VIEW, \
|
||||
|
@ -67,361 +68,354 @@ G_DEFINE_TYPE (MugMsgListView, mug_msg_list_view, GTK_TYPE_TREE_VIEW);
|
|||
static void
|
||||
mug_msg_list_view_class_init (MugMsgListViewClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
||||
parent_class = (GtkTreeViewClass*)g_type_class_peek_parent (klass);
|
||||
gobject_class->finalize = mug_msg_list_view_finalize;
|
||||
parent_class = (GtkTreeViewClass*)g_type_class_peek_parent (klass);
|
||||
gobject_class->finalize = mug_msg_list_view_finalize;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (MugMsgListViewPrivate));
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (MugMsgListViewPrivate));
|
||||
|
||||
signals[MUG_MSG_SELECTED] =
|
||||
g_signal_new ("msg-selected",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MugMsgListViewClass,
|
||||
msg_selected),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
signals[MUG_ERROR_OCCURED] =
|
||||
g_signal_new ("error-occured",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MugMsgListViewClass,
|
||||
error_occured),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals[MUG_MSG_SELECTED] =
|
||||
g_signal_new ("msg-selected",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MugMsgListViewClass,
|
||||
msg_selected),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
signals[MUG_ERROR_OCCURED] =
|
||||
g_signal_new ("error-occured",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MugMsgListViewClass,
|
||||
error_occured),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
}
|
||||
|
||||
static void
|
||||
on_cursor_changed (GtkTreeView * tview, MugMsgListView * lst)
|
||||
{
|
||||
GtkTreeSelection *sel;
|
||||
GtkTreeIter iter;
|
||||
MugMsgListViewPrivate *priv;
|
||||
GtkTreeSelection *sel;
|
||||
GtkTreeIter iter;
|
||||
MugMsgListViewPrivate *priv;
|
||||
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (tview);
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (tview);
|
||||
|
||||
sel = gtk_tree_view_get_selection (tview);
|
||||
if (!sel)
|
||||
return; /* hmmm */
|
||||
if (gtk_tree_selection_get_selected (sel, NULL, &iter)) {
|
||||
char *path;
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (priv->_store), &iter,
|
||||
MUG_COL_PATH, &path, -1);
|
||||
g_signal_emit (G_OBJECT (lst),
|
||||
signals[MUG_MSG_SELECTED], 0, path);
|
||||
g_free (path);
|
||||
}
|
||||
sel = gtk_tree_view_get_selection (tview);
|
||||
if (!sel)
|
||||
return; /* hmmm */
|
||||
if (gtk_tree_selection_get_selected (sel, NULL, &iter)) {
|
||||
char *path;
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (priv->_store), &iter,
|
||||
MUG_COL_PATH, &path, -1);
|
||||
g_signal_emit (G_OBJECT (lst),
|
||||
signals[MUG_MSG_SELECTED], 0, path);
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
treecell_func (GtkTreeViewColumn * tree_column, GtkCellRenderer * renderer,
|
||||
GtkTreeModel * tree_model, GtkTreeIter * iter, gpointer data)
|
||||
GtkTreeModel * tree_model, GtkTreeIter * iter, gpointer data)
|
||||
{
|
||||
MuFlags flags;
|
||||
MuMsgPrio prio;
|
||||
MuFlags flags;
|
||||
MuMsgPrio prio;
|
||||
|
||||
gtk_tree_model_get (tree_model, iter,
|
||||
MUG_COL_FLAGS, &flags, MUG_COL_PRIO, &prio, -1);
|
||||
gtk_tree_model_get (tree_model, iter,
|
||||
MUG_COL_FLAGS, &flags, MUG_COL_PRIO, &prio, -1);
|
||||
|
||||
g_object_set (G_OBJECT (renderer),
|
||||
"weight", (flags & MU_FLAG_NEW) ? 800 : 400,
|
||||
"weight", (flags & MU_FLAG_SEEN) ? 400 : 800,
|
||||
"foreground", prio == MU_MSG_PRIO_HIGH ? "red" : NULL,
|
||||
NULL);
|
||||
g_object_set (G_OBJECT (renderer),
|
||||
"weight", (flags & MU_FLAG_NEW) ? 800 : 400,
|
||||
"weight", (flags & MU_FLAG_SEEN) ? 400 : 800,
|
||||
"foreground", prio == MU_MSG_PRIO_HIGH ? "red" : NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* sortcolidx == -1 means 'sortcolidx = colidx' */
|
||||
static void
|
||||
append_col (GtkTreeView * treeview, const char *label, int colidx,
|
||||
int sortcolidx, gint maxwidth)
|
||||
int sortcolidx, gint maxwidth)
|
||||
{
|
||||
GtkTreeViewColumn *col;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
|
||||
NULL);
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
|
||||
NULL);
|
||||
|
||||
col = gtk_tree_view_column_new_with_attributes (label, renderer, "text",
|
||||
colidx, NULL);
|
||||
g_object_set (G_OBJECT (col), "resizable", TRUE, NULL);
|
||||
col = gtk_tree_view_column_new_with_attributes (label, renderer, "text",
|
||||
colidx, NULL);
|
||||
g_object_set (G_OBJECT (col), "resizable", TRUE, NULL);
|
||||
|
||||
gtk_tree_view_column_set_sort_indicator (col, TRUE);
|
||||
gtk_tree_view_column_set_sort_indicator (col, TRUE);
|
||||
|
||||
if (sortcolidx == -1)
|
||||
sortcolidx = colidx;
|
||||
gtk_tree_view_column_set_sort_column_id (col, sortcolidx);
|
||||
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
if (sortcolidx == -1)
|
||||
sortcolidx = colidx;
|
||||
gtk_tree_view_column_set_sort_column_id (col, sortcolidx);
|
||||
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
|
||||
if (maxwidth) {
|
||||
gtk_tree_view_column_set_fixed_width (col, maxwidth);
|
||||
gtk_tree_view_column_set_expand (col, FALSE);
|
||||
} else
|
||||
gtk_tree_view_column_set_expand (col, TRUE);
|
||||
if (maxwidth) {
|
||||
gtk_tree_view_column_set_fixed_width (col, maxwidth);
|
||||
gtk_tree_view_column_set_expand (col, FALSE);
|
||||
} else
|
||||
gtk_tree_view_column_set_expand (col, TRUE);
|
||||
|
||||
gtk_tree_view_column_set_cell_data_func (col, renderer,
|
||||
(GtkTreeCellDataFunc)
|
||||
treecell_func, NULL, NULL);
|
||||
gtk_tree_view_column_set_cell_data_func (col, renderer,
|
||||
(GtkTreeCellDataFunc)
|
||||
treecell_func, NULL, NULL);
|
||||
|
||||
gtk_tree_view_append_column (treeview, col);
|
||||
gtk_tree_view_append_column (treeview, col);
|
||||
|
||||
gtk_tree_view_columns_autosize (treeview);
|
||||
gtk_tree_view_set_fixed_height_mode (treeview, TRUE);
|
||||
gtk_tree_view_columns_autosize (treeview);
|
||||
gtk_tree_view_set_fixed_height_mode (treeview, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
mug_msg_list_view_init (MugMsgListView * obj)
|
||||
{
|
||||
MugMsgListViewPrivate *priv;
|
||||
GtkTreeView *tview;
|
||||
MugMsgListViewPrivate *priv;
|
||||
GtkTreeView *tview;
|
||||
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (obj);
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (obj);
|
||||
|
||||
priv->_xpath = priv->_query = NULL;
|
||||
priv->_store = gtk_tree_store_new (MUG_N_COLS, G_TYPE_STRING, /* date */
|
||||
G_TYPE_STRING,/* folder */
|
||||
G_TYPE_STRING,/* flagstr */
|
||||
G_TYPE_STRING, /* from */
|
||||
G_TYPE_STRING,/* to */
|
||||
G_TYPE_STRING,/* subject */
|
||||
G_TYPE_STRING, /* path */
|
||||
G_TYPE_UINT, /* prio */
|
||||
G_TYPE_UINT, /* flags */
|
||||
G_TYPE_INT); /* timeval */
|
||||
priv->_xpath = priv->_query = NULL;
|
||||
priv->_store = gtk_tree_store_new (MUG_N_COLS, G_TYPE_STRING, /* date */
|
||||
G_TYPE_STRING,/* folder */
|
||||
G_TYPE_STRING,/* flagstr */
|
||||
G_TYPE_STRING, /* from */
|
||||
G_TYPE_STRING,/* to */
|
||||
G_TYPE_STRING,/* subject */
|
||||
G_TYPE_STRING, /* path */
|
||||
G_TYPE_UINT, /* prio */
|
||||
G_TYPE_UINT, /* flags */
|
||||
G_TYPE_INT); /* timeval */
|
||||
|
||||
tview = GTK_TREE_VIEW (obj);
|
||||
gtk_tree_view_set_model (tview, GTK_TREE_MODEL (priv->_store));
|
||||
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (obj), TRUE);
|
||||
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (obj),
|
||||
GTK_TREE_VIEW_GRID_LINES_VERTICAL);
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (obj), TRUE);
|
||||
tview = GTK_TREE_VIEW (obj);
|
||||
gtk_tree_view_set_model (tview, GTK_TREE_MODEL (priv->_store));
|
||||
gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW (obj), TRUE);
|
||||
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (obj),
|
||||
GTK_TREE_VIEW_GRID_LINES_VERTICAL);
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (obj), TRUE);
|
||||
|
||||
append_col (tview, "Date", MUG_COL_DATESTR, MUG_COL_TIME, 80);
|
||||
append_col (tview, "Folder", MUG_COL_MAILDIR, -1, 60);
|
||||
append_col (tview, "F", MUG_COL_FLAGSSTR, -1, 25);
|
||||
append_col (tview, "From", MUG_COL_FROM, -1, 0);
|
||||
append_col (tview, "To", MUG_COL_TO, -1, 0);
|
||||
append_col (tview, "Subject", MUG_COL_SUBJECT, -1, 0);
|
||||
append_col (tview, "Date", MUG_COL_DATESTR, MUG_COL_TIME, 80);
|
||||
append_col (tview, "Folder", MUG_COL_MAILDIR, -1, 60);
|
||||
append_col (tview, "F", MUG_COL_FLAGSSTR, -1, 25);
|
||||
append_col (tview, "From", MUG_COL_FROM, -1, 0);
|
||||
append_col (tview, "To", MUG_COL_TO, -1, 0);
|
||||
append_col (tview, "Subject", MUG_COL_SUBJECT, -1, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (obj), "cursor-changed",
|
||||
G_CALLBACK (on_cursor_changed), obj);
|
||||
g_signal_connect (G_OBJECT (obj), "cursor-changed",
|
||||
G_CALLBACK (on_cursor_changed), obj);
|
||||
}
|
||||
|
||||
static void
|
||||
mug_msg_list_view_finalize (GObject * obj)
|
||||
{
|
||||
MugMsgListViewPrivate *priv;
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (obj);
|
||||
MugMsgListViewPrivate *priv;
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (obj);
|
||||
|
||||
if (priv->_store)
|
||||
g_object_unref (priv->_store);
|
||||
if (priv->_store)
|
||||
g_object_unref (priv->_store);
|
||||
|
||||
g_free (priv->_xpath);
|
||||
g_free (priv->_query);
|
||||
g_free (priv->_xpath);
|
||||
g_free (priv->_query);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
void
|
||||
mug_msg_list_view_move_first (MugMsgListView * self)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreePath *path;
|
||||
|
||||
g_return_if_fail (MUG_IS_MSG_LIST_VIEW (self));
|
||||
g_return_if_fail (MUG_IS_MSG_LIST_VIEW (self));
|
||||
|
||||
path = gtk_tree_path_new_first ();
|
||||
gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
|
||||
path = gtk_tree_path_new_first ();
|
||||
gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
msg_list_view_move (MugMsgListView * self, gboolean next)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreePath *path;
|
||||
|
||||
gtk_tree_view_get_cursor (GTK_TREE_VIEW (self), &path, NULL);
|
||||
if (!path)
|
||||
return FALSE;
|
||||
gtk_tree_view_get_cursor (GTK_TREE_VIEW (self), &path, NULL);
|
||||
if (!path)
|
||||
return FALSE;
|
||||
|
||||
if (next)
|
||||
gtk_tree_path_next (path);
|
||||
else
|
||||
gtk_tree_path_prev (path);
|
||||
if (next)
|
||||
gtk_tree_path_next (path);
|
||||
else
|
||||
gtk_tree_path_prev (path);
|
||||
|
||||
gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
|
||||
gtk_tree_path_free (path);
|
||||
gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mug_msg_list_view_move_next (MugMsgListView * self)
|
||||
{
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
|
||||
return msg_list_view_move (self, TRUE);
|
||||
return msg_list_view_move (self, TRUE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mug_msg_list_view_move_prev (MugMsgListView * self)
|
||||
{
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
|
||||
return msg_list_view_move (self, FALSE);
|
||||
return msg_list_view_move (self, FALSE);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
mug_msg_list_view_new (const char *xpath)
|
||||
{
|
||||
GtkWidget *w;
|
||||
MugMsgListViewPrivate *priv;
|
||||
GtkWidget *w;
|
||||
MugMsgListViewPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (xpath, NULL);
|
||||
g_return_val_if_fail (xpath, NULL);
|
||||
|
||||
w = GTK_WIDGET (g_object_new (MUG_TYPE_MSG_LIST_VIEW, NULL));
|
||||
w = GTK_WIDGET (g_object_new (MUG_TYPE_MSG_LIST_VIEW, NULL));
|
||||
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (w);
|
||||
priv->_xpath = g_strdup (xpath);
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (w);
|
||||
priv->_xpath = g_strdup (xpath);
|
||||
|
||||
return w;
|
||||
return w;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
empty_or_display_contact (const gchar * str)
|
||||
{
|
||||
if (!str || *str == '\0')
|
||||
return g_strdup ("-");
|
||||
else
|
||||
return mu_str_display_contact (str);
|
||||
if (!str || *str == '\0')
|
||||
return g_strdup ("-");
|
||||
else
|
||||
return mu_str_display_contact (str);
|
||||
|
||||
}
|
||||
|
||||
static MuMsgIter *
|
||||
run_query (const char *xpath, const char *expr, MugMsgListView * self) try
|
||||
static Mu::Option<Mu::QueryResults>
|
||||
run_query (const char *xpath, const char *expr, MugMsgListView * self)
|
||||
{
|
||||
Mu::Store store{xpath};
|
||||
Mu::Store store{xpath};
|
||||
Mu::Query query{store};
|
||||
|
||||
return query.run(expr, MU_MSG_FIELD_ID_DATE,
|
||||
Mu::Query::Flags::Descending |
|
||||
Mu::Query::Flags::SkipUnreadable |
|
||||
Mu::Query::Flags::SkipDups |
|
||||
Mu::Query::Flags::IncludeRelated |
|
||||
Mu::Query::Flags::Threading);
|
||||
} catch (...) {
|
||||
return NULL;
|
||||
return query.run(expr, MU_MSG_FIELD_ID_DATE,
|
||||
Mu::QueryFlags::Descending |
|
||||
Mu::QueryFlags::SkipUnreadable |
|
||||
Mu::QueryFlags::SkipDuplicates |
|
||||
Mu::QueryFlags::IncludeRelated |
|
||||
Mu::QueryFlags::Threading);
|
||||
}
|
||||
|
||||
static void
|
||||
add_row (GtkTreeStore * store, MuMsg *msg, GtkTreeIter *treeiter)
|
||||
{
|
||||
const gchar *datestr, *flagstr;
|
||||
gchar *from, *to;
|
||||
time_t timeval;
|
||||
const gchar *datestr, *flagstr;
|
||||
gchar *from, *to;
|
||||
time_t timeval;
|
||||
|
||||
timeval = mu_msg_get_date (msg);
|
||||
datestr = timeval == 0 ? "-" : mu_date_display_s (timeval);
|
||||
from = empty_or_display_contact (mu_msg_get_from (msg));
|
||||
to = empty_or_display_contact (mu_msg_get_to (msg));
|
||||
flagstr = mu_flags_to_str_s (mu_msg_get_flags (msg), MU_FLAG_TYPE_ANY);
|
||||
timeval = mu_msg_get_date (msg);
|
||||
datestr = timeval == 0 ? "-" : mu_date_display_s (timeval);
|
||||
from = empty_or_display_contact (mu_msg_get_from (msg));
|
||||
to = empty_or_display_contact (mu_msg_get_to (msg));
|
||||
flagstr = mu_flags_to_str_s (mu_msg_get_flags (msg), MU_FLAG_TYPE_ANY);
|
||||
|
||||
/* if (0) { */
|
||||
/* GtkTreeIter myiter; */
|
||||
/* if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(store), */
|
||||
/* &myiter, path)) */
|
||||
/* g_warning ("%s: cannot get iter for %s",
|
||||
* __func__, path); */
|
||||
/* } */
|
||||
/* if (0) { */
|
||||
/* GtkTreeIter myiter; */
|
||||
/* if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(store), */
|
||||
/* &myiter, path)) */
|
||||
/* g_warning ("%s: cannot get iter for %s",
|
||||
* __func__, path); */
|
||||
/* } */
|
||||
|
||||
gtk_tree_store_set (store, treeiter,
|
||||
MUG_COL_DATESTR, datestr,
|
||||
MUG_COL_MAILDIR, mu_msg_get_maildir (msg),
|
||||
MUG_COL_FLAGSSTR, flagstr,
|
||||
MUG_COL_FROM, from,
|
||||
MUG_COL_TO, to,
|
||||
MUG_COL_SUBJECT, mu_msg_get_subject (msg),
|
||||
MUG_COL_PATH, mu_msg_get_path (msg),
|
||||
MUG_COL_PRIO, mu_msg_get_prio (msg),
|
||||
MUG_COL_FLAGS, mu_msg_get_flags (msg),
|
||||
MUG_COL_TIME, timeval, -1);
|
||||
g_free (from);
|
||||
g_free (to);
|
||||
gtk_tree_store_set (store, treeiter,
|
||||
MUG_COL_DATESTR, datestr,
|
||||
MUG_COL_MAILDIR, mu_msg_get_maildir (msg),
|
||||
MUG_COL_FLAGSSTR, flagstr,
|
||||
MUG_COL_FROM, from,
|
||||
MUG_COL_TO, to,
|
||||
MUG_COL_SUBJECT, mu_msg_get_subject (msg),
|
||||
MUG_COL_PATH, mu_msg_get_path (msg),
|
||||
MUG_COL_PRIO, mu_msg_get_prio (msg),
|
||||
MUG_COL_FLAGS, mu_msg_get_flags (msg),
|
||||
MUG_COL_TIME, timeval, -1);
|
||||
g_free (from);
|
||||
g_free (to);
|
||||
}
|
||||
|
||||
static int
|
||||
update_model (GtkTreeStore *store, const char *xpath, const char *query,
|
||||
MugMsgListView *self)
|
||||
MugMsgListView *self)
|
||||
{
|
||||
MuMsgIter *iter;
|
||||
int count;
|
||||
const MuMsgIterThreadInfo *prev_ti = NULL;
|
||||
const auto res{run_query (xpath, query, self)};
|
||||
if (!res) {
|
||||
g_warning ("error: running query failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
iter = run_query (xpath, query, self);
|
||||
if (!iter) {
|
||||
g_warning ("error: running query failed\n");
|
||||
return -1;
|
||||
}
|
||||
auto count{0};
|
||||
|
||||
for (count = 0; !mu_msg_iter_is_done (iter);
|
||||
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;
|
||||
const auto thread_path{it.query_match().thread_path};
|
||||
|
||||
ti = mu_msg_iter_get_thread_info (iter);
|
||||
if (prev_thread_path.find(thread_path) == 0)
|
||||
gtk_tree_store_append (store, &treeiter, &prev_treeiter);
|
||||
else
|
||||
gtk_tree_store_append (store, &treeiter, NULL);
|
||||
|
||||
if (!prev_ti || !g_str_has_prefix (ti->threadpath,
|
||||
prev_ti->threadpath))
|
||||
gtk_tree_store_append (store, &treeiter, NULL);
|
||||
else
|
||||
gtk_tree_store_append (store, &treeiter, &prev_treeiter);
|
||||
/* don't unref msg */
|
||||
add_row (store, it.floating_msg(), &treeiter);
|
||||
|
||||
/* don't unref msg */
|
||||
add_row (store, mu_msg_iter_get_msg_floating (iter), &treeiter);
|
||||
//prev_ti = ti;
|
||||
prev_treeiter = treeiter;
|
||||
prev_thread_path = thread_path;
|
||||
++count;
|
||||
}
|
||||
|
||||
prev_ti = ti;
|
||||
prev_treeiter = treeiter;
|
||||
}
|
||||
|
||||
mu_msg_iter_destroy (iter);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
int
|
||||
mug_msg_list_view_query (MugMsgListView * self, const char *query)
|
||||
{
|
||||
MugMsgListViewPrivate *priv;
|
||||
gboolean rv;
|
||||
MugMsgListViewPrivate *priv;
|
||||
gboolean rv;
|
||||
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), FALSE);
|
||||
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (self);
|
||||
gtk_tree_store_clear (priv->_store);
|
||||
priv = MUG_MSG_LIST_VIEW_GET_PRIVATE (self);
|
||||
gtk_tree_store_clear (priv->_store);
|
||||
|
||||
g_free (priv->_query);
|
||||
priv->_query = query ? g_strdup (query) : NULL;
|
||||
g_free (priv->_query);
|
||||
priv->_query = query ? g_strdup (query) : NULL;
|
||||
|
||||
if (!query)
|
||||
return TRUE;
|
||||
if (!query)
|
||||
return TRUE;
|
||||
|
||||
rv = update_model (priv->_store, priv->_xpath, query, self);
|
||||
rv = update_model (priv->_store, priv->_xpath, query, self);
|
||||
|
||||
gtk_tree_view_expand_all (GTK_TREE_VIEW(self));
|
||||
gtk_tree_view_expand_all (GTK_TREE_VIEW(self));
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mug_msg_list_view_get_query (MugMsgListView * self)
|
||||
{
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), NULL);
|
||||
g_return_val_if_fail (MUG_IS_MSG_LIST_VIEW (self), NULL);
|
||||
|
||||
return MUG_MSG_LIST_VIEW_GET_PRIVATE (self)->_query;
|
||||
return MUG_MSG_LIST_VIEW_GET_PRIVATE (self)->_query;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
** 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.
|
||||
**
|
||||
*/
|
||||
#ifdef HAVE_CONFIG
|
||||
#include "config.h"
|
||||
#endif /*HAVE_CONFIG*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include "mu-msg-view.h"
|
||||
#include "mu-msg-view.hh"
|
||||
#include "mug-msg-view.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg.hh"
|
||||
#include "utils/mu-str.h"
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mug_msg_view_class_init (MugMsgViewClass * klass);
|
||||
static void mug_msg_view_init (MugMsgView * obj);
|
||||
|
@ -58,7 +58,7 @@ mug_msg_view_class_init (MugMsgViewClass * klass)
|
|||
GObjectClass *gobject_class;
|
||||
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;
|
||||
|
||||
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)
|
||||
mu_msg_view_set_message (MU_MSG_VIEW(priv->_view), NULL);
|
||||
else {
|
||||
MuMsg *msg;
|
||||
Mu::MuMsg *msg;
|
||||
|
||||
if (access (msgpath, R_OK) == 0) {
|
||||
msg = mu_msg_new_from_file (msgpath, NULL, NULL);
|
Loading…
Reference in New Issue