aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSivaiah Nallagatla <siva@src.gnome.org>2005-01-21 08:00:25 +0800
committerSivaiah Nallagatla <siva@src.gnome.org>2005-01-21 08:00:25 +0800
commitb0cf4de8c4422032bb5478745d694e31c4df75b5 (patch)
treebf56229743446dd6a03ea1724db44e450e090ddb /plugins
parentbd9b9819b1249c14f6959f167b64d4492f828ea1 (diff)
downloadgsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar.gz
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar.bz2
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar.lz
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar.xz
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.tar.zst
gsoc2013-evolution-b0cf4de8c4422032bb5478745d694e31c4df75b5.zip
intial commit
svn path=/trunk/; revision=28468
Diffstat (limited to 'plugins')
-rw-r--r--plugins/default-source/ChangeLog3
-rw-r--r--plugins/default-source/Makefile.am17
-rw-r--r--plugins/default-source/default-source.c123
-rw-r--r--plugins/default-source/org-gnome-default-source.eplug.in34
4 files changed, 177 insertions, 0 deletions
diff --git a/plugins/default-source/ChangeLog b/plugins/default-source/ChangeLog
new file mode 100644
index 0000000000..d8a42cd5e2
--- /dev/null
+++ b/plugins/default-source/ChangeLog
@@ -0,0 +1,3 @@
+2005-01-21 Sivaiah Nallagatla <snallagatla@novell.com>
+
+ * initil commit
diff --git a/plugins/default-source/Makefile.am b/plugins/default-source/Makefile.am
new file mode 100644
index 0000000000..077164c578
--- /dev/null
+++ b/plugins/default-source/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(EVOLUTION_CFLAGS) \
+ $(EVOLUTION_CALENDAR_CFLAGS) \
+ $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
+ $(SOURCE_SEL_CFLAGS)
+
+@EVO_PLUGIN_RULE@
+
+plugin_DATA = org-gnome-default-source.eplug
+plugin_LTLIBRARIES = liborg-gnome-default-source.la
+
+
+liborg_gnome_default_source_la_SOURCES = default-source.c
+liborg_gnome_default_source_la_LDFLAGS = -module -avoid-version
+
+EXTRA_DIST = org-gnome-default-source.eplug.in
diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c
new file mode 100644
index 0000000000..ff506b13ff
--- /dev/null
+++ b/plugins/default-source/default-source.c
@@ -0,0 +1,123 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2004 D
+ *
+ * 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 Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <gtk/gtk.h>
+
+#include <e-util/e-config.h>
+#include <calendar/gui/e-cal-config.h>
+#include <libedataserver/e-source.h>
+#include <addressbook/gui/widgets/eab-config.h>
+#include <libebook/e-book.h>
+#include <libecal/e-cal.h>
+#include <libedataserver/e-source.h>
+#include <libgnome/gnome-i18n.h>
+#include <string.h>
+GtkWidget* org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data);
+void commit_default_calendar (EPlugin *epl, EConfigTarget *target);
+void commit_default_book (EPlugin *epl, EConfigTarget *target);
+void
+commit_default_calendar (EPlugin *epl, EConfigTarget *target)
+{
+ ECalConfigTargetSource *cal_target;
+ ESource *source;
+
+ cal_target = (ECalConfigTargetSource *) target;
+ source = cal_target->source;
+ if (e_source_get_property (source, "default"))
+ if (!e_cal_set_default_source (source, E_CAL_SOURCE_TYPE_EVENT, NULL))
+ e_cal_set_default_source (source, E_CAL_SOURCE_TYPE_TODO, NULL);
+}
+
+void
+commit_default_book (EPlugin *epl, EConfigTarget *target)
+{
+ EABConfigTargetSource *book_target;
+ ESource *source;
+
+ book_target = (EABConfigTargetSource *) target;
+ source = book_target->source;
+ if (e_source_get_property (source, "default"))
+ e_book_set_default_source (source, NULL);
+
+
+}
+
+static void
+default_source_changed (GtkWidget *check_box, ESource *source)
+{
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_box)))
+ e_source_set_property (source, "default", "true");
+ else
+ e_source_set_property (source, "default", NULL);
+}
+
+
+GtkWidget *
+org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+ GtkWidget *widget;
+ ESource *source;
+ EABConfigTargetSource *book_target;
+
+ if (data->old)
+ return data->old;
+ widget = gtk_check_button_new_with_label (_("Mark as default folder"));
+ book_target = (EABConfigTargetSource *) data->target;
+ source = book_target->source;
+
+ if (e_source_get_property (source, "default"))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+ gtk_container_add (GTK_CONTAINER (data->parent), widget);
+
+ g_signal_connect (GTK_TOGGLE_BUTTON (widget), "toggled", G_CALLBACK (default_source_changed), source);
+ gtk_widget_show (widget);
+ return widget;
+}
+
+
+GtkWidget *
+org_gnome_default_cal (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+ GtkWidget *widget;
+ ESource *source;
+ ECalConfigTargetSource *cal_target;
+ int i;
+
+ if (data->old)
+ return data->old;
+ widget = gtk_check_button_new_with_label (_("Mark as default folder"));
+ cal_target = (ECalConfigTargetSource *) data->target;
+ source = cal_target->source;
+
+ if (e_source_get_property (source, "default"))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+ i = ((GtkTable *)data->parent)->nrows;
+ gtk_table_attach((GtkTable *)data->parent, widget, 1, 2, i, i+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+ g_signal_connect (GTK_TOGGLE_BUTTON (widget), "toggled", G_CALLBACK (default_source_changed), source);
+ gtk_widget_show (widget);
+ return widget;
+}
diff --git a/plugins/default-source/org-gnome-default-source.eplug.in b/plugins/default-source/org-gnome-default-source.eplug.in
new file mode 100644
index 0000000000..127f16c78e
--- /dev/null
+++ b/plugins/default-source/org-gnome-default-source.eplug.in
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<e-plugin-list>
+ <e-plugin
+ type="shlib"
+ location="@PLUGINDIR@/liborg-gnome-default-source.so"
+ id="org.gnome.evolution.plugin.default-source"
+ name="Default Sources">
+ <hook class="org.gnome.evolution.calendar.config:1.0">
+ <group
+ target="source"
+ id="org.gnome.evolution.calendar.calendarProperties"
+ commit="commit_default_calendar"
+ >
+ <item
+ type="item_table"
+ path="00.general/00.source/40.default"
+ factory="org_gnome_default_cal"/>
+ </group>
+ </hook>
+ <hook class="org.gnome.evolution.addressbook.config:1.0">
+ <group
+ target="source"
+ id="com.novell.evolution.addressbook.config.accountEditor"
+ commit="commit_default_book"
+ >
+ <item
+ type="item"
+ path="00.general/10.display/30.default"
+ factory="org_gnome_default_book"/>
+ </group>
+ </hook>
+
+ </e-plugin>
+</e-plugin-list>