Commit 09a335ec authored by Matthew Barnes's avatar Matthew Barnes
Browse files

Adapt itip-formatter plugin to the new ESource API.

parent 93857432
NULL =
@EVO_PLUGIN_RULE@
plugin_DATA = org-gnome-itip-formatter.eplug
plugin_LTLIBRARIES = liborg-gnome-itip-formatter.la
liborg_gnome_itip_formatter_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
$(EVOLUTION_DATA_SERVER_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS)
liborg_gnome_itip_formatter_la_SOURCES = itip-formatter.c itip-view.c itip-view.h
liborg_gnome_itip_formatter_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_itip_formatter_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/calendar/gui/libevolution-calendar.la \
$(top_builddir)/mail/libevolution-mail.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/em-format/libemformat.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/libemail-utils/libemail-utils.la \
$(top_builddir)/libemail-engine/libemail-engine.la \
liborg_gnome_itip_formatter_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
$(EVOLUTION_DATA_SERVER_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS) \
$(NULL)
liborg_gnome_itip_formatter_la_SOURCES = \
e-conflict-search-selector.c \
e-conflict-search-selector.h \
e-source-conflict-search.c \
e-source-conflict-search.h \
itip-formatter.c \
itip-view.c \
itip-view.h \
$(NULL)
liborg_gnome_itip_formatter_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
liborg_gnome_itip_formatter_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/calendar/gui/libevolution-calendar.la \
$(top_builddir)/mail/libevolution-mail.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/em-format/libemformat.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/libemail-utils/libemail-utils.la \
$(top_builddir)/libemail-engine/libemail-engine.la \
$(top_builddir)/libevolution-utils/libevolution-utils.la \
$(EVOLUTION_DATA_SERVER_LIBS) \
$(GNOME_PLATFORM_LIBS)
$(EVOLUTION_DATA_SERVER_LIBS) \
$(GNOME_PLATFORM_LIBS) \
$(NULL)
error_DATA = org-gnome-itip-formatter.error
errordir = $(privdatadir)/errors
......@@ -37,6 +50,7 @@ CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
org-gnome-itip-formatter.eplug.xml \
org-gnome-itip-formatter.error.xml
org-gnome-itip-formatter.error.xml \
$(NULL)
-include $(top_srcdir)/git.mk
/*
* e-conflict-search-selector.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
#include "e-conflict-search-selector.h"
#include <libedataserver/e-source-calendar.h>
#include "e-source-conflict-search.h"
/* This forces the GType to be registered in a way that
* avoids a "statement with no effect" compiler warning. */
#define REGISTER_TYPE(type) \
(g_type_class_unref (g_type_class_ref (type)))
G_DEFINE_TYPE (
EConflictSearchSelector,
e_conflict_search_selector,
E_TYPE_SOURCE_SELECTOR)
static gboolean
conflict_search_selector_get_source_selected (ESourceSelector *selector,
ESource *source)
{
ESourceConflictSearch *extension;
const gchar *extension_name;
/* Make sure this source is a calendar. */
extension_name = e_source_selector_get_extension_name (selector);
if (!e_source_has_extension (source, extension_name))
return FALSE;
extension_name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
extension = e_source_get_extension (source, extension_name);
g_return_val_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension), FALSE);
return e_source_conflict_search_get_include_me (extension);
}
static void
conflict_search_selector_set_source_selected (ESourceSelector *selector,
ESource *source,
gboolean selected)
{
ESourceConflictSearch *extension;
const gchar *extension_name;
/* Make sure this source is a calendar. */
extension_name = e_source_selector_get_extension_name (selector);
if (!e_source_has_extension (source, extension_name))
return;
extension_name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
extension = e_source_get_extension (source, extension_name);
g_return_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension));
if (selected != e_source_conflict_search_get_include_me (extension)) {
e_source_conflict_search_set_include_me (extension, selected);
e_source_selector_queue_write (selector, source);
}
}
static void
e_conflict_search_selector_class_init (EConflictSearchSelectorClass *class)
{
ESourceSelectorClass *source_selector_class;
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
source_selector_class->get_source_selected =
conflict_search_selector_get_source_selected;
source_selector_class->set_source_selected =
conflict_search_selector_set_source_selected;
REGISTER_TYPE (E_TYPE_SOURCE_CONFLICT_SEARCH);
}
static void
e_conflict_search_selector_init (EConflictSearchSelector *selector)
{
}
GtkWidget *
e_conflict_search_selector_new (ESourceRegistry *registry)
{
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_CONFLICT_SEARCH_SELECTOR,
"extension-name", E_SOURCE_EXTENSION_CALENDAR,
"registry", registry, NULL);
}
/*
* e-conflict-search-selector.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
#ifndef E_CONFLICT_SEARCH_SELECTOR_H
#define E_CONFLICT_SEARCH_SELECTOR_H
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
#define E_TYPE_CONFLICT_SEARCH_SELECTOR \
(e_conflict_search_selector_get_type ())
#define E_CONFLICT_SEARCH_SELECTOR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_CONFLICT_SEARCH_SELECTOR, EConflictSearchSelector))
#define E_CONFLICT_SEARCH_SELECTOR_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_CONFLICT_SEARCH_SELECTOR, EConflictSearchSelectorClass))
#define E_IS_CONFLICT_SEARCH_SELECTOR(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_CONFLICT_SEARCH_SELECTOR))
#define E_IS_CONFLICT_SEARCH_SELECTOR_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_CONFLICT_SEARCH_SELECTOR))
#define E_CONFLICT_SEARCH_SELECTOR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_CONFLICT_SEARCH_SELECTOR, EConflictSearchSelectorClass))
G_BEGIN_DECLS
typedef struct _EConflictSearchSelector EConflictSearchSelector;
typedef struct _EConflictSearchSelectorClass EConflictSearchSelectorClass;
typedef struct _EConflictSearchSelectorPrivate EConflictSearchSelectorPrivate;
struct _EConflictSearchSelector {
ESourceSelector parent;
EConflictSearchSelectorPrivate *priv;
};
struct _EConflictSearchSelectorClass {
ESourceSelectorClass parent_class;
};
GType e_conflict_search_selector_get_type
(void) G_GNUC_CONST;
GtkWidget * e_conflict_search_selector_new (ESourceRegistry *registry);
G_END_DECLS
#endif /* E_CONFLICT_SEARCH_SELECTOR_H */
/*
* e-source-conflict-search.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
#include "e-source-conflict-search.h"
#define E_SOURCE_CONFLICT_SEARCH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SOURCE_CONFLICT_SEARCH, ESourceConflictSearchPrivate))
struct _ESourceConflictSearchPrivate {
gboolean include_me;
};
enum {
PROP_0,
PROP_INCLUDE_ME
};
G_DEFINE_TYPE (
ESourceConflictSearch,
e_source_conflict_search,
E_TYPE_SOURCE_EXTENSION)
static void
source_conflict_search_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_INCLUDE_ME:
e_source_conflict_search_set_include_me (
E_SOURCE_CONFLICT_SEARCH (object),
g_value_get_boolean (value));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
source_conflict_search_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_INCLUDE_ME:
g_value_set_boolean (
value,
e_source_conflict_search_get_include_me (
E_SOURCE_CONFLICT_SEARCH (object)));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
e_source_conflict_search_class_init (ESourceConflictSearchClass *class)
{
GObjectClass *object_class;
ESourceExtensionClass *extension_class;
g_type_class_add_private (class, sizeof (ESourceConflictSearchPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->set_property = source_conflict_search_set_property;
object_class->get_property = source_conflict_search_get_property;
extension_class = E_SOURCE_EXTENSION_CLASS (class);
extension_class->name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
g_object_class_install_property (
object_class,
PROP_INCLUDE_ME,
g_param_spec_boolean (
"include-me",
"IncludeMe",
"Include this calendar in when "
"searching for scheduling conflicts",
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS |
E_SOURCE_PARAM_SETTING));
}
static void
e_source_conflict_search_init (ESourceConflictSearch *extension)
{
extension->priv = E_SOURCE_CONFLICT_SEARCH_GET_PRIVATE (extension);
}
/**
* e_source_conflict_search_get_include_me:
* @extension: an #ESourceConflictSearch
*
* Returns whether the calendar described by the #ESource to which
* @extension belongs should be queried for scheduling conflicts when
* negotiating a meeting invitation.
*
* Returns: whether to search for scheduling conflicts
*
* Since: 3.6
**/
gboolean
e_source_conflict_search_get_include_me (ESourceConflictSearch *extension)
{
g_return_val_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension), FALSE);
return extension->priv->include_me;
}
/**
* e_source_conflict_search_set_include_me:
* @extension: an #ESourceConflictSearch
* @include_me: whether to search for scheduling conflicts
*
* Sets whether the calendar described by the #ESource to which @extension
* belongs should be queried for scheduling conflicts when negotiating a
* meeting invitation.
*
* Since: 3.6
**/
void
e_source_conflict_search_set_include_me (ESourceConflictSearch *extension,
gboolean include_me)
{
g_return_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension));
extension->priv->include_me = include_me;
g_object_notify (G_OBJECT (extension), "include-me");
}
/*
* e-source-conflict-search.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
#ifndef E_SOURCE_CONFLICT_SEARCH_H
#define E_SOURCE_CONFLICT_SEARCH_H
#include <libedataserver/e-source-extension.h>
/* Standard GObject macros */
#define E_TYPE_SOURCE_CONFLICT_SEARCH \
(e_source_conflict_search_get_type ())
#define E_SOURCE_CONFLICT_SEARCH(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_SOURCE_CONFLICT_SEARCH, ESourceConflictSearch))
#define E_SOURCE_CONFLICT_SEARCH_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_SOURCE_CONFLICT_SEARCH, ESourceConflictSearchClass))
#define E_IS_SOURCE_CONFLICT_SEARCH(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_SOURCE_CONFLICT_SEARCH))
#define E_IS_SOURCE_CONFLICT_SEARCH_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_SOURCE_CONFLICT_SEARCH))
#define E_SOURCE_CONFLICT_SEARCH_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_SOURCE_CONFLICT_SEARCH, ESourceConflictSearchClass))
/**
* E_SOURCE_EXTENSION_CONFLICT_SEARCH:
*
* Pass this extension name to e_source_get_extension() to access
* #ESourceConflictSearch. This is also used as a group name in key files.
*
* Since: 3.6
**/
#define E_SOURCE_EXTENSION_CONFLICT_SEARCH "Conflict Search"
G_BEGIN_DECLS
typedef struct _ESourceConflictSearch ESourceConflictSearch;
typedef struct _ESourceConflictSearchClass ESourceConflictSearchClass;
typedef struct _ESourceConflictSearchPrivate ESourceConflictSearchPrivate;
/**
* ESourceConflictSearch:
*
* Contains only private data that should be read and manipulated using the
* functions below.
*
* Since: 3.6
**/
struct _ESourceConflictSearch {
ESourceExtension parent;
ESourceConflictSearchPrivate *priv;
};
struct _ESourceConflictSearchClass {
ESourceExtensionClass parent_class;
};
GType e_source_conflict_search_get_type
(void) G_GNUC_CONST;
gboolean e_source_conflict_search_get_include_me
(ESourceConflictSearch *extension);
void e_source_conflict_search_set_include_me
(ESourceConflictSearch *extension,
gboolean include_me);
G_END_DECLS
#endif /* E_SOURCE_CONFLICT_SEARCH_H */
This diff is collapsed.
......@@ -33,7 +33,6 @@
#include <libecal/e-cal-time-util.h>
#include <mail/em-format-hook.h>
#include <mail/em-format-html.h>
#include <libedataserver/e-account-list.h>
#include <e-util/e-util.h>
#include <e-util/e-unicode.h>
#include <calendar/gui/itip-utils.h>
......@@ -59,6 +58,11 @@ typedef struct {
} ItipViewInfoItem;
struct _ItipViewPrivate {
ESourceRegistry *registry;
gulong source_added_id;
gulong source_removed_id;
gchar *extension_name;
ItipViewMode mode;
ECalClientSourceType type;
......@@ -93,8 +97,6 @@ struct _ItipViewPrivate {
gchar *description;
ESourceList *source_list;
gint buttons_sensitive : 1;
gboolean is_recur_set;
......@@ -150,6 +152,12 @@ struct _ItipViewPrivate {
#define DIV_ITIP_CONTENT "div_itip_content"
#define DIV_ITIP_ERROR "div_itip_error"
enum {
PROP_0,
PROP_EXTENSION_NAME,
PROP_REGISTRY
};
enum {
SOURCE_SELECTED,
RESPONSE,
......@@ -729,85 +737,6 @@ button_clicked_cb (WebKitDOMElement *element,
g_signal_emit (G_OBJECT (data), signals[RESPONSE], 0, response);
}
static void
itip_view_finalize (GObject *object)
{
ItipViewPrivate *priv;
GSList *iter;
priv = ITIP_VIEW_GET_PRIVATE (object);
d(printf("Itip view finalized!\n"));
g_free (priv->sender);
g_free (priv->organizer);
g_free (priv->organizer_sentby);
g_free (priv->delegator);
g_free (priv->attendee);
g_free (priv->attendee_sentby);
g_free (priv->proxy);
g_free (priv->summary);
g_free (priv->location);
g_free (priv->status);
g_free (priv->comment);
g_free (priv->start_tm);
g_free (priv->start_label);
g_free (priv->end_tm);
g_free (priv->end_label);
g_free (priv->description);
g_free (priv->error);
for (iter = priv->lower_info_items; iter; iter = iter->next) {
ItipViewInfoItem *item = iter->data;
g_free (item->message);
g_free (item);
}
g_slist_free (priv->lower_info_items);
for (iter = priv->upper_info_items; iter; iter = iter->next) {
ItipViewInfoItem *item = iter->data;
g_free (item->message);
g_free (item);
}
g_slist_free (priv->upper_info_items);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (itip_view_parent_class)->finalize (object);
}
static void
itip_view_class_init (ItipViewClass *class)
{
GObjectClass *object_class;
g_type_class_add_private (class, sizeof (ItipViewPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->finalize = itip_view_finalize;
signals[SOURCE_SELECTED] = g_signal_new (
"source_selected",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ItipViewClass, source_selected),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
E_TYPE_SOURCE);
signals[RESPONSE] = g_signal_new (
"response",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ItipViewClass, response),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1,
G_TYPE_INT);
}
static void
rsvp_toggled_cb (WebKitDOMHTMLInputElement *input,
WebKitDOMEvent *event,
......@@ -872,10 +801,12 @@ source_changed_cb (WebKitDOMElement *select,
{
ESource *source;
source = itip_view_get_source (view);
source = itip_view_ref_source (view);
</