[gnome-calendar] subscriber: rework ::remove and ::modified vfuncs
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] subscriber: rework ::remove and ::modified vfuncs
- Date: Fri, 9 Jan 2015 14:29:51 +0000 (UTC)
commit caf4031efe48b7508d7cd086ed2f1e006a67b1c7
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Mon Dec 29 16:12:57 2014 -0500
subscriber: rework ::remove and ::modified vfuncs
Since we have now access to the hash keeping the children of thw widget
there's no more need of calling GcalView::get_by_uuid
src/gcal-subscriber.c | 43 ++++++++++++++++++++++++-------------------
1 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/src/gcal-subscriber.c b/src/gcal-subscriber.c
index 292cbab..24b35d0 100644
--- a/src/gcal-subscriber.c
+++ b/src/gcal-subscriber.c
@@ -326,28 +326,32 @@ gcal_subscriber_component_modified (ECalDataModelSubscriber *subscriber,
ECalClient *client,
ECalComponent *comp)
{
- GtkWidget *event;
- GtkWidget *widget;
+ GcalSubscriberPrivate *priv;
+ GList *l;
+ GtkWidget *new_widget;
GcalEventData *data;
+ priv = gcal_subscriber_get_instance_private (GCAL_SUBSCRIBER (subscriber));
data = g_new0 (GcalEventData, 1);
data->source = e_client_get_source (E_CLIENT (client));
data->event_component = e_cal_component_clone (comp);
- event = gcal_event_widget_new_from_data (data);
+ new_widget = gcal_event_widget_new_from_data (data);
g_free (data);
- widget =
- gcal_view_get_by_uuid (
- GCAL_VIEW (subscriber),
- gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (event)));
-
- if (widget != NULL)
+ l = g_hash_table_lookup (priv->children, gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (new_widget)));
+ if (l != NULL)
{
- gtk_widget_destroy (widget);
+ gtk_widget_destroy (l->data);
- gtk_widget_show (event);
- gtk_container_add (GTK_CONTAINER (subscriber), event);
+ gtk_widget_show (new_widget);
+ gtk_container_add (GTK_CONTAINER (subscriber), new_widget);
+ }
+ else
+ {
+ g_warning ("%s: Widget with uuid: %s not found",
+ G_STRFUNC, gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (new_widget)));
+ gtk_widget_destroy (new_widget);
}
}
@@ -357,23 +361,24 @@ gcal_subscriber_component_removed (ECalDataModelSubscriber *subscriber,
const gchar *uid,
const gchar *rid)
{
- GtkWidget *widget;
+ GcalSubscriberPrivate *priv;
const gchar *sid;
gchar *uuid;
+ GList *l;
- sid = e_source_get_uid (e_client_get_source (E_CLIENT (client)));
+ priv = gcal_subscriber_get_instance_private (GCAL_SUBSCRIBER (subscriber));
+ sid = e_source_get_uid (e_client_get_source (E_CLIENT (client)));
if (rid != NULL)
uuid = g_strdup_printf ("%s:%s:%s", sid, uid, rid);
else
uuid = g_strdup_printf ("%s:%s", sid, uid);
- widget = gcal_view_get_by_uuid (GCAL_VIEW (subscriber), uuid);
- if (widget != NULL)
- gtk_widget_destroy (widget);
+ l = g_hash_table_lookup (priv->children, uuid);
+ if (l != NULL)
+ gtk_widget_destroy (l->data);
else
- g_warning ("%s: Widget with uuid: %s not found",
- G_STRFUNC, uuid);
+ g_warning ("%s: Widget with uuid: %s not found", G_STRFUNC, uuid);
g_free (uuid);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]