aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-12-23 20:25:21 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-12-23 20:25:21 +0800
commit3022554239b4f9ee31e622048a849a33a1ea54d5 (patch)
tree021d7a26efdb4cf5122333feaf1150437f6cb667 /calendar
parent3270f7a07f0ffa0f111804c0e55cdc0b479bd690 (diff)
downloadgsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar.gz
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar.bz2
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar.lz
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar.xz
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.tar.zst
gsoc2013-evolution-3022554239b4f9ee31e622048a849a33a1ea54d5.zip
renamed from *_uri, to work with ESource's rather than with plain URIs.
2003-12-22 Rodrigo Moya <rodrigo@ximian.com> * gui/gnome-cal.[ch] (gnome_calendar_add_event_source, gnome_calendar_remove_event_source): renamed from *_uri, to work with ESource's rather than with plain URIs. (gnome_calendar_set_default_source): ditto. * gui/control-factory.c (set_prop): * gui/calendar-component.c (add_uri_for_source, remove_uri_for_source, update_uri_for_primary_selection): use sources instead of uris with the GnomeCalendar widget. svn path=/trunk/; revision=24005
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/calendar-component.c14
-rw-r--r--calendar/gui/control-factory.c13
-rw-r--r--calendar/gui/gnome-cal.c55
-rw-r--r--calendar/gui/gnome-cal.h6
5 files changed, 65 insertions, 35 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 4cb0b09a02..6b78a30a2d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,17 @@
2003-12-22 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/gnome-cal.[ch] (gnome_calendar_add_event_source,
+ gnome_calendar_remove_event_source): renamed from *_uri, to work with
+ ESource's rather than with plain URIs.
+ (gnome_calendar_set_default_source): ditto.
+
+ * gui/control-factory.c (set_prop):
+ * gui/calendar-component.c (add_uri_for_source, remove_uri_for_source,
+ update_uri_for_primary_selection):
+ use sources instead of uris with the GnomeCalendar widget.
+
+2003-12-22 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/alarm-notify/save.c (get_saved_notification_time): if the setting
is not in the config database, use the current time, to avoid getting
hundreds of alarms for past events.
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index c9be642fbd..2167415d9b 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -82,19 +82,13 @@ extern ECompEditorRegistry *comp_editor_registry;
static void
add_uri_for_source (ESource *source, GnomeCalendar *calendar)
{
- char *uri = e_source_get_uri (source);
-
- gnome_calendar_add_event_uri (calendar, uri);
- g_free (uri);
+ gnome_calendar_add_event_source (calendar, source);
}
static void
remove_uri_for_source (ESource *source, GnomeCalendar *calendar)
{
- char *uri = e_source_get_uri (source);
-
- gnome_calendar_remove_event_uri (calendar, uri);
- g_free (uri);
+ gnome_calendar_remove_event_source (calendar, source);
}
static gboolean
@@ -193,9 +187,7 @@ update_uri_for_primary_selection (CalendarComponent *calendar_component)
return;
/* Set the default */
- uri = e_source_get_uri (source);
- gnome_calendar_set_default_uri (priv->calendar, uri);
- g_free (uri);
+ gnome_calendar_set_default_source (priv->calendar, source);
/* Make sure we are embedded first */
calendar_control_sensitize_calendar_commands (priv->view_control, priv->calendar, TRUE);
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index 58436ec841..b114300b5a 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -118,6 +118,8 @@ set_prop (BonoboPropertyBag *bag,
GnomeCalendar *gcal;
char *string;
GnomeCalendarViewType view;
+ ESource *source;
+ ESourceGroup *group;
BonoboControl *control = user_data;
gcal = (GnomeCalendar *) bonobo_control_get_widget (control);
@@ -125,7 +127,12 @@ set_prop (BonoboPropertyBag *bag,
switch (arg_id) {
case PROPERTY_CALENDAR_URI_IDX:
string = BONOBO_ARG_GET_STRING (arg);
- if (gnome_calendar_add_event_uri (gcal, string)) {
+
+ group = e_source_group_new ("", string);
+ source = e_source_new ("", "");
+ e_source_set_group (source, group);
+
+ if (gnome_calendar_add_event_source (gcal, source)) {
calendar_control_sensitize_calendar_commands (control, gcal, TRUE);
} else {
char *msg;
@@ -136,6 +143,10 @@ set_prop (BonoboPropertyBag *bag,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
g_free (msg);
}
+
+ g_object_unref (source);
+ g_object_unref (group);
+
break;
case PROPERTY_CALENDAR_VIEW_IDX:
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 96198a3d2e..a836047e90 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2136,36 +2136,40 @@ gnome_calendar_get_task_pad_e_cal (GnomeCalendar *gcal)
}
/**
- * gnome_calendar_add_event_uri:
+ * gnome_calendar_add_event_source:
* @gcal: A GnomeCalendar.
- * @str_uri: URI to add to the calendar views.
+ * @source: #ESource to add to the calendar views.
*
- * Adds the given calendar URI to the calendar views.
+ * Adds the given calendar source to the calendar views.
*
* Returns: TRUE if successful, FALSE if error.
*/
gboolean
-gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
+gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
int i;
+ char *str_uri;
g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = gcal->priv;
+ str_uri = e_source_get_uri (source);
client = g_hash_table_lookup (priv->clients, str_uri);
+ g_free (str_uri);
if (client)
return TRUE;
- client = auth_new_cal_from_uri (str_uri, E_CAL_SOURCE_TYPE_EVENT);
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
if (!client)
return FALSE;
- g_hash_table_insert (priv->clients, g_strdup (str_uri), client);
+ str_uri = e_source_get_uri (source);
+ g_hash_table_insert (priv->clients, str_uri, client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), gcal);
@@ -2179,6 +2183,7 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
+ g_free (str_uri);
g_object_unref (client);
return FALSE;
@@ -2198,33 +2203,36 @@ gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri)
}
/**
- * gnome_calendar_remove_event_uri
+ * gnome_calendar_remove_event_source
* @gcal: A #GnomeCalendar.
- * @str_uri: URI to be removed from the clients.
+ * @source: #ESource to be removed from the clients.
*
- * Removes the given URI from the list of clients being shown by the
+ * Removes the given source from the list of clients being shown by the
* calendar views.
*
* Returns: TRUE if successful, FALSE otherwise.
*/
gboolean
-gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
+gnome_calendar_remove_event_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
int i;
+ char *str_uri, *orig_uri;
g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = gcal->priv;
- client = g_hash_table_lookup (priv->clients, str_uri);
- if (!client)
+ str_uri = e_source_get_uri (source);
+ if (!g_hash_table_lookup_extended (priv->clients, str_uri, &orig_uri, &client)) {
+ g_free (str_uri);
return TRUE;
+ }
- g_hash_table_remove (priv->clients, str_uri);
+ g_hash_table_remove (priv->clients, orig_uri);
priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
@@ -2236,6 +2244,10 @@ gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
e_cal_model_remove_client (model, client);
}
+ g_free (orig_uri);
+ g_free (str_uri);
+ g_object_unref (client);
+
/* update date navigator query */
update_query (gcal);
@@ -2243,9 +2255,9 @@ gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
}
/**
- * gnome_calendar_set_default_uri:
+ * gnome_calendar_set_default_source:
* @gcal: A calendar view
- * @uri: The uri to use as default
+ * @source: The #ESource to use as default
*
* Set the default uri on the given calendar view, the default uri
* will be used as the default when creating events in the view.
@@ -2255,19 +2267,22 @@ gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri)
* otherwise
**/
gboolean
-gnome_calendar_set_default_uri (GnomeCalendar *gcal, const char *str_uri)
+gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
int i;
+ char *str_uri;
g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
- g_return_val_if_fail (str_uri != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
priv = gcal->priv;
-
+
+ str_uri = e_source_get_uri (source);
client = g_hash_table_lookup (priv->clients, str_uri);
+ g_free (str_uri);
if (!client)
return FALSE;
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 896faaa13b..d63ac53f4f 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -108,9 +108,9 @@ ECalModel *gnome_calendar_get_calendar_model (GnomeCalendar *gcal);
ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal);
ECal *gnome_calendar_get_task_pad_e_cal(GnomeCalendar *gcal);
-gboolean gnome_calendar_add_event_uri (GnomeCalendar *gcal, const char *str_uri);
-gboolean gnome_calendar_remove_event_uri (GnomeCalendar *gcal, const char *str_uri);
-gboolean gnome_calendar_set_default_uri (GnomeCalendar *gcal, const char *str_uri);
+gboolean gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source);
+gboolean gnome_calendar_remove_event_source (GnomeCalendar *gcal, ESource *source);
+gboolean gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source);
void gnome_calendar_set_query (GnomeCalendar *gcal, const char *sexp);