#include "e-misc-utils.h"
#define E_CAL_SOURCE_CONFIG_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_SOURCE_CONFIG, ECalSourceConfigPrivate))
struct _ECalSourceConfigPrivate {
ECalClientSourceType source_type;
GtkWidget *color_button;
GtkWidget *default_button;
};
enum {
PROP_0,
PROP_SOURCE_TYPE
};
G_DEFINE_TYPE (
ECalSourceConfig,
e_cal_source_config,
E_TYPE_SOURCE_CONFIG)
static ESource *
cal_source_config_ref_default (ESourceConfig *config)
{
ECalSourceConfigPrivate *priv;
ESourceRegistry *registry;
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
registry = e_source_config_get_registry (config);
if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
return e_source_registry_ref_default_calendar (registry);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
return e_source_registry_ref_default_memo_list (registry);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
return e_source_registry_ref_default_task_list (registry);
g_return_val_if_reached (NULL);
}
static void
cal_source_config_set_default (ESourceConfig *config,
ESource *source)
{
ECalSourceConfigPrivate *priv;
ESourceRegistry *registry;
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
registry = e_source_config_get_registry (config);
if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS)
e_source_registry_set_default_calendar (registry, source);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
e_source_registry_set_default_memo_list (registry, source);
else if (priv->source_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS)
e_source_registry_set_default_task_list (registry, source);
}
static void
cal_source_config_set_source_type (ECalSourceConfig *config,
ECalClientSourceType source_type)
{
config->priv->source_type = source_type;
}
static void
cal_source_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_SOURCE_TYPE:
cal_source_config_set_source_type (
E_CAL_SOURCE_CONFIG (object),
g_value_get_enum (value));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
cal_source_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_SOURCE_TYPE:
g_value_set_enum (
value,
e_cal_source_config_get_source_type (
E_CAL_SOURCE_CONFIG (object)));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
cal_source_config_dispose (GObject *object)
{
ECalSourceConfigPrivate *priv;
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (object);
if (priv->color_button != NULL) {
g_object_unref (priv->color_button);
priv->color_button = NULL;
}
if (priv->default_button != NULL) {
g_object_unref (priv->default_button);
priv->default_button = NULL;
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_cal_source_config_parent_class)->dispose (object);
}
static void
cal_source_config_constructed (GObject *object)
{
ECalSourceConfigPrivate *priv;
ESource *default_source;
ESource *original_source;
ESourceConfig *config;
GObjectClass *class;
GtkWidget *widget;
const gchar *label;
/* Chain up to parent's constructed() method. */
class = G_OBJECT_CLASS (e_cal_source_config_parent_class);
class->constructed (object);
config = E_SOURCE_CONFIG (object);
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (object);
widget = gtk_color_button_new ();
priv->color_button = g_object_ref_sink (widget);
gtk_widget_show (widget);
switch (priv->source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
label = _("Mark as default calendar");
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
label = _("Mark as default task list");
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
label = _("Mark as default memo list");
break;
default:
/* No need to translate this string. */
label = "Invalid ECalSourceType value";
g_warn_if_reached ();
}
widget = gtk_check_button_new_with_label (label);
priv->default_button = g_object_ref_sink (widget);
gtk_widget_show (widget);
default_source = cal_source_config_ref_default (config);
original_source = e_source_config_get_original_source (config);
if (original_source != NULL) {
gboolean active;
active = e_source_equal (original_source, default_source);
g_object_set (priv->default_button, "active", active, NULL);
}
g_object_unref (default_source);
e_source_config_insert_widget (
config, NULL, _("Color:"), priv->color_button);
e_source_config_insert_widget (
config, NULL, NULL, priv->default_button);
}
static const gchar *
cal_source_config_get_backend_extension_name (ESourceConfig *config)
{
ECalSourceConfig *cal_config;
const gchar *extension_name;
cal_config = E_CAL_SOURCE_CONFIG (config);
switch (e_cal_source_config_get_source_type (cal_config)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
extension_name = E_SOURCE_EXTENSION_CALENDAR;
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
break;
default:
g_return_val_if_reached (NULL);
}
return extension_name;
}
static GList *
cal_source_config_list_eligible_collections (ESourceConfig *config)
{
GQueue trash = G_QUEUE_INIT;
GList *list, *link;
/* Chain up to parent's list_eligible_collections() method. */
list = E_SOURCE_CONFIG_CLASS (e_cal_source_config_parent_class)->
list_eligible_collections (config);
for (link = list; link != NULL; link = g_list_next (link)) {
ESource *source = E_SOURCE (link->data);
ESourceCollection *extension;
const gchar *extension_name;
extension_name = E_SOURCE_EXTENSION_COLLECTION;
extension = e_source_get_extension (source, extension_name);
if (!e_source_collection_get_calendar_enabled (extension))
g_queue_push_tail (&trash, link);
}
/* Remove ineligible collections from the list. */
while ((link = g_queue_pop_head (&trash)) != NULL) {
g_object_unref (link->data);
list = g_list_delete_link (list, link);
}
return list;
}
static void
cal_source_config_init_candidate (ESourceConfig *config,
ESource *scratch_source)
{
ECalSourceConfigPrivate *priv;
ESourceConfigClass *class;
ESourceExtension *extension;
const gchar *extension_name;
/* Chain up to parent's init_candidate() method. */
class = E_SOURCE_CONFIG_CLASS (e_cal_source_config_parent_class);
class->init_candidate (config, scratch_source);
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
extension_name = e_source_config_get_backend_extension_name (config);
extension = e_source_get_extension (scratch_source, extension_name);
g_object_bind_property_full (
extension, "color",
priv->color_button, "color",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE,
e_binding_transform_string_to_color,
e_binding_transform_color_to_string,
NULL, (GDestroyNotify) NULL);
}
static void
cal_source_config_commit_changes (ESourceConfig *config,
ESource *scratch_source)
{
ECalSourceConfigPrivate *priv;
GtkToggleButton *toggle_button;
ESourceConfigClass *class;
ESource *default_source;
priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
toggle_button = GTK_TOGGLE_BUTTON (priv->default_button);
/* Chain up to parent's commit_changes() method. */
class = E_SOURCE_CONFIG_CLASS (e_cal_source_config_parent_class);
class->commit_changes (config, scratch_source);
default_source = cal_source_config_ref_default (config);
/* The default setting is a little tricky to get right. If
* the toggle button is active, this ESource is now the default.
* That much is simple. But if the toggle button is NOT active,
* then we have to inspect the old default. If this ESource WAS
* the default, reset the default to 'system'. If this ESource
* WAS NOT the old default, leave it alone. */
if (gtk_toggle_button_get_active (toggle_button))
cal_source_config_set_default (config, scratch_source);
else if (e_source_equal (scratch_source, default_source))
cal_source_config_set_default (config, NULL);
g_object_unref (default_source);
}
static void
e_cal_source_config_class_init (ECalSourceConfigClass *class)
{
GObjectClass *object_class;
ESourceConfigClass *source_config_class;
g_type_class_add_private (class, sizeof (ECalSourceConfigPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->set_property = cal_source_config_set_property;
object_class->get_property = cal_source_config_get_property;
object_class->dispose = cal_source_config_dispose;
object_class->constructed = cal_source_config_constructed;
source_config_class = E_SOURCE_CONFIG_CLASS (class);
source_config_class->get_backend_extension_name =
cal_source_config_get_backend_extension_name;
source_config_class->list_eligible_collections =
cal_source_config_list_eligible_collections;
source_config_class->init_candidate = cal_source_config_init_candidate;
source_config_class->commit_changes = cal_source_config_commit_changes;
g_object_class_install_property (
object_class,
PROP_SOURCE_TYPE,
g_param_spec_enum (
"source-type",
"Source Type",
"The iCalendar object type",
E_TYPE_CAL_CLIENT_SOURCE_TYPE,
E_CAL_CLIENT_SOURCE_TYPE_EVENTS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
static void
e_cal_source_config_init (ECalSourceConfig *config)
{
config->priv = E_CAL_SOURCE_CONFIG_GET_PRIVATE (config);
}
GtkWidget *
e_cal_source_config_new (ESourceRegistry *registry,
ESource *original_source,
ECalClientSourceType source_type)
{
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
if (original_source != NULL)
g_return_val_if_fail (E_IS_SOURCE (original_source), NULL);
return g_object_new (
E_TYPE_CAL_SOURCE_CONFIG, "registry", registry,
"original-source", original_source, "source-type",
source_type, NULL);
}
ECalClientSourceType
e_cal_source_config_get_source_type (ECalSourceConfig *config)
{
g_return_val_if_fail (E_IS_CAL_SOURCE_CONFIG (config), 0);
return config->priv->source_type;
}
void
e_cal_source_config_add_offline_toggle (ECalSourceConfig *config,
ESource *scratch_source)
{
GtkWidget *widget;
ESourceExtension *extension;
const gchar *extension_name;
const gchar *label;
g_return_if_fail (E_IS_CAL_SOURCE_CONFIG (config));
g_return_if_fail (E_IS_SOURCE (scratch_source));
extension_name = E_SOURCE_EXTENSION_OFFLINE;
extension = e_source_get_extension (scratch_source, extension_name);
switch (e_cal_source_config_get_source_type (config)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
label = _("Copy calendar contents locally "
"for offline operation");
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
label = _("Copy task list contents locally "
"for offline operation");
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
label = _("Copy memo list contents locally "
"for offline operation");
break;
default:
g_return_if_reached ();
}
widget = gtk_check_button_new_with_label (label);
e_source_config_insert_widget (
E_SOURCE_CONFIG (config), scratch_source, NULL, widget);
gtk_widget_show (widget);
g_object_bind_property (
extension, "stay-synchronized",
widget, "active",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
}
gi/freebsd-ports-gnome/commit/audio?h=mate-1.16&id=5df765f1cba8d8b2cc5230b08531765b08211474'>Mark as broken as it is no more available on public mirrorbapt | 2011-06-10 | 1 | -0/+2 |
* | Make support for Apple iPhone/iPod Touch (and thus `comms/libimobiledevice' | danfe | 2011-06-09 | 1 | -3/+5 |
* | Update to 1.1.0. No user-visible changes. | naddy | 2011-06-09 | 3 | -13/+13 |
* | Update my e-mail to my FreeBSD one. | jlaffaye | 2011-06-09 | 1 | -1/+1 |
* | - Update to 2.4.1. | avilla | 2011-06-08 | 4 | -26/+29 |
* | update thunar to 1.2.2 | oliver | 2011-06-07 | 1 | -1/+1 |
* | update libexo to 0.6.1 | oliver | 2011-06-07 | 1 | -1/+1 |
* | - Change this port to use the USERS and GROUPS variables [1] | rene | 2011-06-07 | 3 | -84/+5 |
* | Chase security/gnutls update and add an UPDATING entry. | novel | 2011-06-06 | 1 | -1/+1 |
* | - Update to 12.2 | dhn | 2011-06-05 | 2 | -4/+3 |
* | - Update to 0.9.0 | pav | 2011-06-03 | 9 | -168/+1066 |
* | - Updatet to 0.7.3 | miwi | 2011-06-03 | 2 | -7/+6 |
* | - Update to 0.14 | culot | 2011-06-03 | 4 | -8/+21 |
* | - Fix problem with pkg_version | sylvio | 2011-06-01 | 1 | -1/+1 |
* | - Chase devel/ucommon shlib bump | gahr | 2011-06-01 | 1 | -1/+2 |
* | - Fix problem with version number | sylvio | 2011-05-31 | 1 | -1/+1 |
* | Bump PORTREVISION of all ports dependent on lang/ghc as during | ashish | 2011-05-26 | 3 | -2/+3 |
* | - Change PORTVERSION to DISTVERSION in due of package to be a release candidate | sylvio | 2011-05-24 | 2 | -1/+4 |
* | - Update to RC1 | sylvio | 2011-05-23 | 3 | -9/+10 |
* | - Update again because they rerolled the distfile and fixed the directory str... | decke | 2011-05-23 | 2 | -3/+3 |
* | - Add license | sylvio | 2011-05-21 | 1 | -1/+1 |
* | - Update to 0.24.1 | decke | 2011-05-20 | 2 | -3/+4 |
* | Rename CONF_FILES to avoid conflict with an upcoming infrastructure change. | jkim | 2011-05-20 | 1 | -2/+2 |
* | - Add license | sylvio | 2011-05-20 | 13 | -2/+25 |
* | Mark BROKEN: leaves files behind on deinstallation | erwin | 2011-05-18 | 1 | -0/+2 |
* | - Update to 1.5.4 | sylvio | 2011-05-16 | 3 | -5/+10 |
* | - Update to 1.4.21 | sylvio | 2011-05-16 | 2 | -3/+12 |
* | - Update to 1.45.04 | nivit | 2011-05-16 | 3 | -3/+5 |
* | - Fix the executable name of the run-dependency audio/musicpd | nivit | 2011-05-16 | 2 | -2/+2 |
* | - Add option WITH_AVAHI (default off) to support Zeroconf through avahi | nivit | 2011-05-16 | 3 | -14/+35 |
* | - Update to 2011.04.29 | sylvio | 2011-05-16 | 2 | -3/+3 |
* | - move multimedia/rebot3 to audio/rebot3 | jadawin | 2011-05-16 | 4 | -0/+50 |
* | - Update to version 0.3.1 [1] | danfe | 2011-05-16 | 6 | -56/+17 |
* | Remove painful examples of foo="", with particular prejudice against | dougb | 2011-05-15 | 2 | -2/+0 |
* | Change the URL to something that actually works. | brooks | 2011-05-15 | 1 | -1/+1 |
* | - Fix the build on recent -CURRENT/amd64 [1] | danfe | 2011-05-14 | 2 | -7/+98 |
* | - Remove empty files | culot | 2011-05-14 | 2 | -0/+0 |
* | -Update to 0.6.0 | beech | 2011-05-14 | 5 | -43/+24 |
* | - Update to 1.13.3 | novel | 2011-05-13 | 2 | -4/+3 |
* | - Mark BROKEN: unfetchable | pav | 2011-05-12 | 1 | -0/+1 |
* | Update Gstreamer (core) to 0.10.33 | kwm | 2011-05-11 | 1 | -0/+2 |
* | Update math/gsl to 1.15, and adjust PORTREVISION | bf | 2011-05-10 | 2 | -2/+3 |
* | - Please welcome GHC 7.0.3 | ashish | 2011-05-09 | 8 | -106/+32 |
* | Pacify portlint by unclobbering CONFIGURE_ENV, no functional change. | ehaupt | 2011-05-06 | 1 | -6/+0 |
* | Pacify portlint by unclobbering CONFIGURE_ENV, no functional change. | ehaupt | 2011-05-06 | 1 | -5/+2 |
* | - Handle config file properly on pkg_delete and reinstall, don't just | nox | 2011-05-06 | 2 | -5/+13 |
* | - update to 1.111200 | bapt | 2011-05-05 | 2 | -3/+3 |
* | - Update to 1.3.13 | dhn | 2011-05-05 | 5 | -41/+72 |
* | - Hook audio/teamspeak3-server into the build | glarkin | 2011-05-04 | 1 | -0/+1 |
* | - Updated to 3.0.0.b30 [1] | glarkin | 2011-05-04 | 9 | -399/+519 |
* | Another bunch of expired ports removal | bapt | 2011-05-03 | 19 | -325/+0 |
* | There is no such thing as EXPIRATION, change it to EXPIRATION_DATE | dougb | 2011-05-03 | 5 | -5/+5 |
* | - Fix build with Ruby 1.9 | swills | 2011-05-03 | 1 | -0/+6 |
* | - Fix build with Ruby 1.9 | swills | 2011-05-03 | 1 | -0/+3 |
* | - Fix build with Ruby 1.9 | swills | 2011-05-03 | 1 | -0/+4 |
* | Deprecate some ports that looks like abandonwares. | bapt | 2011-05-03 | 1 | -0/+3 |
* | - Limit brokedness status to amd64 arch | pav | 2011-05-03 | 1 | -1/+1 |
* | Update pianobar to latest version. | jpaetzel | 2011-05-02 | 3 | -42/+12 |
* | One more bunch of unmaintained expired ports removal | bapt | 2011-05-02 | 13 | -232/+0 |
* | Bump PORTREVISION after open-mofit update | makc | 2011-05-02 | 7 | -4/+7 |
* | Fix build with open-motif-2.3.3 | makc | 2011-05-02 | 2 | -2/+2 |
* | - Fix build with Ruby 1.9 | swills | 2011-05-02 | 1 | -0/+96 |
* | - Mark BROKEN on 9-CURRENT: | pav | 2011-05-02 | 1 | -1/+7 |
* | Correct pkg-descr: | nox | 2011-04-29 | 1 | -2/+3 |
* | PulseAudio plugin for ALSA | nox | 2011-04-29 | 8 | -0/+99 |
* | The audacious binary got renamed from audacious2 to audacious. | oliver | 2011-04-28 | 2 | -3/+3 |
* | Update to 0.65 to unbreak after recent audacious update. | ehaupt | 2011-04-28 | 2 | -6/+5 |
* | By Maintainer's request, toss these ports back into the pool | dougb | 2011-04-27 | 1 | -1/+1 |
* | This package contains the runtime libraries for any application that wishes | nox | 2011-04-27 | 6 | -0/+80 |
* | - Update to 1.07 | decke | 2011-04-26 | 3 | -4/+8 |
* | - Update to 2.4.0 | culot | 2011-04-26 | 3 | -14/+3 |
* | - Update to 0.7 | culot | 2011-04-25 | 3 | -3/+17 |
* | - Update to 12.1 | dhn | 2011-04-24 | 3 | -3/+8 |
* | - Update to 0.5.7 | dhn | 2011-04-23 | 2 | -4/+3 |
* | Upgrade to 7.5.4 release.[1] | brooks | 2011-04-23 | 4 | -12/+16 |
* | - fix build on i386 | dinoex | 2011-04-21 | 1 | -1/+7 |
* | Don't override PORTREVISION from slave ports so their version | erwin | 2011-04-20 | 1 | -1/+1 |
* | - Fix PLIST | gahr | 2011-04-14 |