diff options
Diffstat (limited to 'plugins/calendar-file')
-rw-r--r-- | plugins/calendar-file/Makefile.am | 27 | ||||
-rw-r--r-- | plugins/calendar-file/calendar-file.c | 249 | ||||
-rw-r--r-- | plugins/calendar-file/org-gnome-calendar-file.eplug.xml | 22 |
3 files changed, 0 insertions, 298 deletions
diff --git a/plugins/calendar-file/Makefile.am b/plugins/calendar-file/Makefile.am deleted file mode 100644 index c36053f550..0000000000 --- a/plugins/calendar-file/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-calendar-file.eplug - -plugin_LTLIBRARIES = liborg-gnome-calendar-file.la - -liborg_gnome_calendar_file_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -I$(top_srcdir) \ - $(EVOLUTION_DATA_SERVER_CFLAGS) \ - $(GNOME_PLATFORM_CFLAGS) - -liborg_gnome_calendar_file_la_SOURCES = calendar-file.c - -liborg_gnome_calendar_file_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - -liborg_gnome_calendar_file_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(EVOLUTION_DATA_SERVER_LIBS) \ - $(GNOME_PLATFORM_LIBS) - -EXTRA_DIST = org-gnome-calendar-file.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c deleted file mode 100644 index 32ba96aa8a..0000000000 --- a/plugins/calendar-file/calendar-file.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * 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/> - * - * - * Authors: - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtk.h> -#include <e-util/e-config.h> -#include <e-util/e-plugin-util.h> -#include <calendar/gui/e-cal-config.h> -#include <libedataserver/e-source.h> -#include <glib/gi18n.h> -#include <string.h> - -gint e_plugin_lib_enable (EPlugin *ep, gint enable); - -gint -e_plugin_lib_enable (EPlugin *ep, - gint enable) -{ - return 0; -} - -static void -location_changed (GtkFileChooserButton *widget, - ESource *source) -{ - gchar *filename; - - g_return_if_fail (widget != NULL); - g_return_if_fail (source != NULL); - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - e_source_set_property ( - source, "custom-file", - (filename && *filename) ? filename : NULL); - g_free (filename); -} - -static void -maincheck_toggled (GtkToggleButton *check, - ESource *source) -{ - GtkWidget *w; - gboolean enabled = gtk_toggle_button_get_active (check); - - w = g_object_get_data (G_OBJECT (check), "child"); - gtk_widget_set_sensitive (w, enabled); - - /* used with source = NULL to enable widgets only */ - if (!source) - return; - - if (enabled) { - gchar *file; - - w = g_object_get_data (G_OBJECT (check), "file-chooser"); - file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w)); - e_source_set_property (source, "custom-file", (file && *file) ? file : NULL); - g_free (file); - } else { - e_source_set_property (source, "custom-file", NULL); - } -} - -static void -refresh_type_changed (GtkComboBox *refresh_type, - ESource *source) -{ - GtkWidget *refresh_hbox; - gint active = gtk_combo_box_get_active (refresh_type); - gchar buff[2] = {0}; - - refresh_hbox = g_object_get_data (G_OBJECT (refresh_type), "refresh-hbox"); - - if (active < 0 || active > 2) - active = 0; - - if (active == 2) { - gtk_widget_show (refresh_hbox); - } else { - gtk_widget_hide (refresh_hbox); - } - - buff[0] = '0' + active; - e_source_set_property (source, "refresh-type", buff); -} - -GtkWidget *e_calendar_file_customs (EPlugin *epl, EConfigHookItemFactoryData *data); - -GtkWidget * -e_calendar_file_customs (EPlugin *epl, - EConfigHookItemFactoryData *data) -{ - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - const gchar *relative_uri, *value; - guint n_rows; - GtkWidget *w1, *w2, *box1, *box2, *mainbox, *maincheck; - - if (!e_plugin_util_is_source_proto (source, "local")) - return NULL; - - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri && g_str_equal (relative_uri, "system")) - return NULL; - - e_source_set_relative_uri (source, e_source_get_uid (source)); - - mainbox = gtk_vbox_new (FALSE, 2); - g_object_get (data->parent, "n-rows", &n_rows, NULL); - gtk_table_attach ( - GTK_TABLE (data->parent), mainbox, - 1, 2, n_rows, n_rows + 1, - GTK_EXPAND | GTK_FILL, 0, 0, 0); - - maincheck = gtk_check_button_new_with_mnemonic (_("C_ustomize options")); - gtk_box_pack_start ((GtkBox *) mainbox, maincheck, TRUE, TRUE, 2); - - box1 = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start ((GtkBox *) mainbox, box1, TRUE, TRUE, 2); - - g_object_set_data ((GObject*)maincheck, "child", box1); - - /* left-most space, the first one */ - w1 = gtk_label_new (""); - gtk_box_pack_start ((GtkBox *) box1, w1, FALSE, TRUE, 8); - - box2 = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start ((GtkBox *) box1, box2, TRUE, TRUE, 2); - - box1 = box2; - box2 = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start ((GtkBox *) box1, box2, TRUE, TRUE, 2); - - w1 = gtk_label_new_with_mnemonic (_("F_ilename:")); - gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); - gtk_box_pack_start ((GtkBox *) box2, w1, FALSE, TRUE, 2); - - w2 = gtk_file_chooser_button_new ( - _("Choose calendar file"), GTK_FILE_CHOOSER_ACTION_OPEN); - gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (w2), TRUE); - gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); - gtk_box_pack_start ((GtkBox *) box2, w2, TRUE, TRUE, 2); - - g_object_set_data (G_OBJECT (maincheck), "file-chooser", w2); - - value = e_source_get_property (source, "custom-file"); - if (value && *value) { - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (w2), value); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), TRUE); - } else { - gchar *file = NULL; - const gchar *file_name = NULL; - - switch (t->source_type) { - case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: - file_name = "calendar.ics"; - break; - case E_CAL_CLIENT_SOURCE_TYPE_TASKS: - file_name = "tasks.ics"; - break; - case E_CAL_CLIENT_SOURCE_TYPE_MEMOS: - file_name = "journal.ics"; - break; - case E_CAL_CLIENT_SOURCE_TYPE_LAST: - break; - } - - file = g_build_filename (g_get_home_dir (), file_name, NULL); - if (file && *file) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (w2), file); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (maincheck), FALSE); - g_free (file); - } - maincheck_toggled (GTK_TOGGLE_BUTTON (maincheck), NULL); - - g_signal_connect ( - w2, "file-set", - G_CALLBACK (location_changed), source); - g_signal_connect ( - maincheck, "toggled", - G_CALLBACK (maincheck_toggled), source); - - box2 = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start ((GtkBox *) box1, box2, FALSE, TRUE, 2); - - w1 = gtk_label_new_with_mnemonic (_("Re_fresh:")); - gtk_misc_set_alignment (GTK_MISC (w1), 0.0, 0.5); - gtk_box_pack_start ((GtkBox *) box2, w1, FALSE, TRUE, 2); - - w2 = gtk_combo_box_text_new (); - /* Translators: This is one setting for when to refresh a memo/calendar/tasks list */ - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w2), _("On open")); - /* Translators: This is one setting for when to refresh a memo/calendar/tasks list */ - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w2), _("On file change")); - /* Translators: This is one setting for when to refresh a memo/calendar/tasks list */ - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w2), _("Periodically")); - gtk_label_set_mnemonic_widget (GTK_LABEL (w1), w2); - gtk_box_pack_start ((GtkBox *) box2, w2, FALSE, TRUE, 2); - - value = e_source_get_property (source, "refresh-type"); - gtk_combo_box_set_active ( - (GtkComboBox *) w2, - (value && *value && !value[1] && value[0] >= '0' && - value[0] <= '2') ? value[0] - '0' : 0); - - w1 = w2; - w2 = e_plugin_util_add_refresh (NULL, NULL, source, "refresh"); - gtk_box_pack_start (GTK_BOX (box2), w2, FALSE, TRUE, 0); - - g_object_set_data (G_OBJECT (w1), "refresh-hbox", w2); - - g_signal_connect ( - w1, "changed", - G_CALLBACK (refresh_type_changed), source); - - w2 = e_plugin_util_add_check ( - NULL, _("Force read _only"), source, - "custom-file-readonly", "1", NULL); - gtk_box_pack_start ((GtkBox *) box1, w2, TRUE, TRUE, 2); - - gtk_widget_show_all (mainbox); - - /* w1 is a refresh-type combobox, and it hides widgets, - * thus should be called after show_all call */ - refresh_type_changed (GTK_COMBO_BOX (w1), source); - - return mainbox; -} diff --git a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml b/plugins/calendar-file/org-gnome-calendar-file.eplug.xml deleted file mode 100644 index a9c6379636..0000000000 --- a/plugins/calendar-file/org-gnome-calendar-file.eplug.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-calendar-file@SOEXT@" - id="org.gnome.evolution.calendar.file" - _name="Local Calendars" - system_plugin="true"> - <author name="JP Rosevear" email="jpr@novell.com"/> - <_description>Add local calendars to Evolution.</_description> - <hook class="org.gnome.evolution.calendar.config:1.0"> - <group - target="source" - id="org.gnome.evolution.calendar.calendarProperties"> - <item - type="item_table" - path="00.general/00.source/99.file_customs" - factory="e_calendar_file_customs"/> - </group> - </hook> - </e-plugin> -</e-plugin-list> |