views: correctly hide events according to the mod type
When deleting events with recurrence, we want to hide the event widgets according to the modification type. So that selecting e.g. subsequent in the modification type dialog hides the event, and the subsequent ones, truly reflecting the operation that will happen. Currently, however, the views don't do that, and only hide the event that was asked to be deleted. Fix that by passing the object modification type, and adapting the views to take that into account.
This commit is contained in:
@@ -972,17 +972,23 @@ gcal_month_view_clear_marks (GcalView *view)
|
||||
}
|
||||
|
||||
static GList*
|
||||
gcal_month_view_get_children_by_uuid (GcalView *view,
|
||||
const gchar *uuid)
|
||||
gcal_month_view_get_children_by_uuid (GcalView *view,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid)
|
||||
{
|
||||
GcalSubscriberViewPrivate *ppriv = GCAL_SUBSCRIBER_VIEW (view)->priv;
|
||||
GList *l;
|
||||
GHashTableIter iter;
|
||||
GList *children;
|
||||
GList *tmp;
|
||||
|
||||
l = g_hash_table_lookup (ppriv->children, uuid);
|
||||
if (l != NULL)
|
||||
return g_list_reverse (g_list_copy (l));
|
||||
children = NULL;
|
||||
|
||||
return NULL;
|
||||
g_hash_table_iter_init (&iter, ppriv->children);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &tmp))
|
||||
children = g_list_concat (children, g_list_copy (tmp));
|
||||
|
||||
return filter_event_list_by_uid_and_modtype (children, mod, uuid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+15
-13
@@ -19,6 +19,7 @@
|
||||
|
||||
#define G_LOG_DOMAIN "GcalWeekGrid"
|
||||
|
||||
#include "gcal-debug.h"
|
||||
#include "gcal-week-grid.h"
|
||||
#include "gcal-week-view.h"
|
||||
#include "gcal-utils.h"
|
||||
@@ -1238,32 +1239,33 @@ gcal_week_grid_remove_event (GcalWeekGrid *self,
|
||||
}
|
||||
|
||||
GList*
|
||||
gcal_week_grid_get_children_by_uuid (GcalWeekGrid *self,
|
||||
const gchar *uid)
|
||||
gcal_week_grid_get_children_by_uuid (GcalWeekGrid *self,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uid)
|
||||
{
|
||||
GPtrArray *widgets;
|
||||
GList *events;
|
||||
GList *result;
|
||||
guint i;
|
||||
|
||||
GCAL_ENTRY;
|
||||
|
||||
events = NULL;
|
||||
result = NULL;
|
||||
widgets = gcal_range_tree_get_data_at_range (self->events, 0, MAX_MINUTES);
|
||||
|
||||
for (i = 0; widgets && i < widgets->len; i++)
|
||||
{
|
||||
ChildData *data;
|
||||
GcalEvent *event;
|
||||
|
||||
data = g_ptr_array_index (widgets, i);
|
||||
event = gcal_event_widget_get_event (GCAL_EVENT_WIDGET (data->widget));
|
||||
|
||||
if (g_strcmp0 (gcal_event_get_uid (event), uid) == 0)
|
||||
result = g_list_prepend (result, data->widget);
|
||||
|
||||
ChildData *data = g_ptr_array_index (widgets, i);
|
||||
events = g_list_prepend (events, data->widget);
|
||||
}
|
||||
|
||||
g_clear_pointer (&widgets, g_ptr_array_unref);
|
||||
result = filter_event_list_by_uid_and_modtype (events, mod, uid);
|
||||
|
||||
return result;
|
||||
g_clear_pointer (&widgets, g_ptr_array_unref);
|
||||
g_clear_pointer (&events, g_list_free);
|
||||
|
||||
GCAL_RETURN (result);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -46,8 +46,9 @@ void gcal_week_grid_add_event (GcalWeekGrid
|
||||
void gcal_week_grid_remove_event (GcalWeekGrid *self,
|
||||
const gchar *uid);
|
||||
|
||||
GList* gcal_week_grid_get_children_by_uuid (GcalWeekGrid *self,
|
||||
const gchar *uid);
|
||||
GList* gcal_week_grid_get_children_by_uuid (GcalWeekGrid *self,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uid);
|
||||
|
||||
void gcal_week_grid_clear_marks (GcalWeekGrid *self);
|
||||
|
||||
|
||||
@@ -1677,32 +1677,20 @@ gcal_week_header_remove_event (GcalWeekHeader *self,
|
||||
}
|
||||
|
||||
GList*
|
||||
gcal_week_header_get_children_by_uuid (GcalWeekHeader *self,
|
||||
const gchar *uuid)
|
||||
gcal_week_header_get_children_by_uuid (GcalWeekHeader *self,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid)
|
||||
{
|
||||
GList *children, *l, *result;
|
||||
GList *children, *result;
|
||||
|
||||
GCAL_ENTRY;
|
||||
|
||||
result = NULL;
|
||||
children = gtk_container_get_children (GTK_CONTAINER (self->grid));
|
||||
|
||||
for (l = children; l != NULL; l = l->next)
|
||||
{
|
||||
GcalEventWidget *child_widget;
|
||||
GcalEvent *event;
|
||||
|
||||
if (!GCAL_IS_EVENT_WIDGET (l->data))
|
||||
continue;
|
||||
|
||||
child_widget = GCAL_EVENT_WIDGET (l->data);
|
||||
event = gcal_event_widget_get_event (child_widget);
|
||||
|
||||
if (g_strcmp0 (uuid, gcal_event_get_uid (event)) == 0)
|
||||
result = g_list_prepend (result, l->data);
|
||||
}
|
||||
result = filter_event_list_by_uid_and_modtype (children, mod, uuid);
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
return result;
|
||||
GCAL_RETURN (result);
|
||||
}
|
||||
|
||||
GtkSizeGroup*
|
||||
|
||||
@@ -46,8 +46,9 @@ void gcal_week_header_add_event (GcalWeekHeader
|
||||
void gcal_week_header_remove_event (GcalWeekHeader *self,
|
||||
const gchar *uuid);
|
||||
|
||||
GList* gcal_week_header_get_children_by_uuid (GcalWeekHeader *self,
|
||||
const gchar *uuid);
|
||||
GList* gcal_week_header_get_children_by_uuid (GcalWeekHeader *self,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid);
|
||||
|
||||
GtkSizeGroup* gcal_week_header_get_sidebar_size_group (GcalWeekHeader *self);
|
||||
|
||||
|
||||
@@ -220,17 +220,20 @@ gcal_week_view_set_date (GcalView *view,
|
||||
}
|
||||
|
||||
static GList*
|
||||
gcal_week_view_get_children_by_uuid (GcalView *view,
|
||||
const gchar *uuid)
|
||||
gcal_week_view_get_children_by_uuid (GcalView *view,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid)
|
||||
{
|
||||
GcalWeekView *self;
|
||||
GList *grid, *header;
|
||||
|
||||
self = GCAL_WEEK_VIEW (view);
|
||||
grid = gcal_week_grid_get_children_by_uuid (GCAL_WEEK_GRID (self->week_grid), uuid);
|
||||
header = gcal_week_header_get_children_by_uuid (GCAL_WEEK_HEADER (self->header), uuid);
|
||||
GCAL_ENTRY;
|
||||
|
||||
return g_list_concat (grid, header);
|
||||
self = GCAL_WEEK_VIEW (view);
|
||||
grid = gcal_week_grid_get_children_by_uuid (GCAL_WEEK_GRID (self->week_grid), mod, uuid);
|
||||
header = gcal_week_header_get_children_by_uuid (GCAL_WEEK_HEADER (self->header), mod, uuid);
|
||||
|
||||
GCAL_RETURN (g_list_concat (grid, header));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1589,26 +1589,17 @@ gcal_year_view_set_date (GcalView *view,
|
||||
}
|
||||
|
||||
static GList*
|
||||
gcal_year_view_get_children_by_uuid (GcalView *view,
|
||||
const gchar *uuid)
|
||||
gcal_year_view_get_children_by_uuid (GcalView *view,
|
||||
GcalRecurrenceModType mod,
|
||||
const gchar *uuid)
|
||||
{
|
||||
GcalYearView *year_view = GCAL_YEAR_VIEW (view);
|
||||
GList *children, *l, *result = NULL;
|
||||
GcalYearView *self = GCAL_YEAR_VIEW (view);
|
||||
GList *result, *children;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (year_view->events_sidebar));
|
||||
result = NULL;
|
||||
|
||||
for (l = children; l != NULL; l = g_list_next (l))
|
||||
{
|
||||
GcalEventWidget *child_widget;
|
||||
GcalEvent *event;
|
||||
|
||||
child_widget = GCAL_EVENT_WIDGET (gtk_bin_get_child (GTK_BIN (l->data)));
|
||||
event = gcal_event_widget_get_event (child_widget);
|
||||
|
||||
|
||||
if (child_widget != NULL && g_strcmp0 (uuid, gcal_event_get_uid (event)) == 0)
|
||||
result = g_list_append (result, child_widget);
|
||||
}
|
||||
children = gtk_container_get_children (GTK_CONTAINER (self->sidebar));
|
||||
result = filter_event_list_by_uid_and_modtype (children, mod, uuid);
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user