Commit Graph
218 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 82b5953b76 month-view: fix invalid cell calculation 2016-05-21 19:15:14 -03:00
Georges Basile Stavracas Neto 5960a45d00 month-view: consider the days delay when dealing with the cell
The cell number does not consider the days delay, thus is not
the current day. To find the current day, we must remove the
days delay.
2016-05-21 19:02:39 -03:00
Georges Basile Stavracas Neto c2bf75d151 month-view: improve rendering of DnD target
This commit makes the lines always 1px.
2016-05-21 18:54:47 -03:00
Georges Basile Stavracas Neto 220d7c88bd month-view: save the event when dragged and dropped
This magical commit finally implements the Drag n' Drop
feature for Month view by changing the start and end dates
of the events according to the cell where the user drops
the event.
2016-05-21 18:54:47 -03:00
Georges Basile Stavracas Neto 1f534aa97e month-view: hold a pointer to the singleton GcalManager
It'll be used in the next commit to save the DnD'ed event.
2016-05-21 18:54:47 -03:00
Georges Basile Stavracas Neto 982b7da02b month-view: draw a drop target background
When dragging an event, it is very important to have
a visual feedback of the possible target areas.

As such, add a gtk_render_background() call to render
the drag cell's background.
2016-05-21 18:54:47 -03:00
Georges Basile Stavracas Neto d0821d7e4d month-view: set as a drag destination
The month view will be the first one to receive
support for drag and drop. As such, it must be
set as a drag destination.
2016-05-21 18:54:47 -03:00
Georges Basile Stavracas Neto e6c9ecd7eb month-view: clear the pointer when it's not stored in place
It leaks a reference, but only happens for end date.
2016-05-18 11:57:43 -03:00
Georges Basile Stavracas Neto 12e6de6383 month-view: update comments
Many things changed during the mean time.
2016-05-18 11:51:10 -03:00
Georges Basile Stavracas Neto 266474c1e3 month-view: correctly check if dates are different
The previous commit introduced many changes in the way
the conditions are done. Unfortunately, one of these
conditions was only partially fixed.

Fix that by using the correct function to compare dates.
2016-05-18 11:27:11 -03:00
Georges Basile Stavracas Neto 692a9639a3 month-view: fix various reference issues with GDateTime
The current code does multiple needless unrefs, uses the
GDateTime API in a wrongly manner and leaks references
all around.

This causes the Calendar application to emit multiple warning
messages and in the worst case, crash immediately.

Fix that by rewriting the critical sections of the code that
deals with the start and end mark cells.

https://bugzilla.gnome.org/show_bug.cgi?id=763641
2016-05-18 11:20:00 -03:00
Georges Basile Stavracas Neto 48df0903e5 month-view: consider the top padding for the extra events popover
When the mouse button is released, only the bottom padding was being
taken into account to calculate whether the click was in the "Show
N events" area.

This commit fixes this issue by considering the top padding as well.

https://bugzilla.gnome.org/show_bug.cgi?id=765678
2016-05-08 14:14:56 -03:00
pandusonu2 a3cbaf1e81 month-view: selection across months
In this commit we change the data type of start_mark_cell and end_mark_cell to GDateTime from gint

Currently, the mark_cell's are gint and while moving across months, they cause a problem as they don't take the new month into consideration but the cell value of the selector.

To fix this, we changed the data type of the mark_cell's and modified all the functions dependant on it.

https://bugzilla.gnome.org/show_bug.cgi?id=763641
2016-03-26 17:31:25 -03:00
fosero 96d2b37fec month-view: fix end-of-month multi-day selections
Use g_date_time_add_days to add a day to the final day of the month to
fix behaviour when selecting a range up to the last day of the month.

https://bugzilla.gnome.org/show_bug.cgi?id=763015
2016-03-14 16:54:54 -03:00
fosero c67d52092c month-view: fix date adjust mishap
https://bugzilla.gnome.org/show_bug.cgi?id=763015
2016-03-14 16:54:53 -03:00
fosero 8a72bf0ce7 month-view: add selection background fill
https://bugzilla.gnome.org/show_bug.cgi?id=763217
2016-03-12 21:58:22 -03:00
fosero 0ce85f6072 month-view: cleanup multi-row selection drawing
The selection mode was drawing a number of boxes on multi-row
selections, resulting in unwanted outlines within the selection area.
This patch adds a multirow mode that just draws the outline of a
selection.

Make cell_{width,height} integers so divison lines always get drawn on
exact grid coordinates, otherwise line calculations could result in
fuzzy lines.

https://bugzilla.gnome.org/show_bug.cgi?id=763217
2016-03-12 21:58:22 -03:00
fosero 0fce5babcf month-view: fix line width inconsistencies
The line width used for the grid changed over time, resulting in
different values used at different places. Introduce a LINE_WIDTH
definition and use it consistently throughout when drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=763217
2016-03-12 21:58:22 -03:00
pandusonu2 a738acb462 month-view: wrap around months for selector
In this commit, we modify the position of the selector in the month view when the selector is out of bound of the present month

Presently, the selector in the month view doesn't move when it reaches the border of the month.

To fix this, whenever the keyboard_cell is less than first index of the month, we reduce the value of month by 1 and in the case it is greater than the max key cell, we are increasing the value of month by 1.

https://bugzilla.gnome.org/show_bug.cgi?id=763198
2016-03-11 22:44:15 -03:00
fosero 97704c3390 month-view: fix last day+1 selectable
It was possible to select the cell after the last day of the month by
clicking on it.

The days variable is the first day of the month cell + the number of
days in the month, so only cells less than this cell should be
considered actual month days.

https://bugzilla.gnome.org/show_bug.cgi?id=763495
2016-03-11 11:05:33 -03:00
Georges Basile Stavracas Neto 1f021f8da2 month-view: fix one more child context issue
The code for multiday events was broken as well.
2016-03-09 17:42:21 -03:00
Georges Basile Stavracas Neto 34a6ac389a view: update interface code
This commit updates GcalView interface to use
modern GLib API and, consequently, removes tons
of obsolete code.
2016-03-09 14:19:04 -03:00
Georges Basile Stavracas Neto 042a9b34ab month-view: emit dates in local timezone 2016-03-09 12:22:06 -03:00
Georges Basile Stavracas Neto 1c52e36c71 month-view: match style context state from child
We were mistakenly using the style context of the view
to retrieve the child's margin.

Fix that by retrieving the child margin from the child's
style context.
2016-03-09 12:04:28 -03:00
fosero ba78e54916 month-view: initial selection on current day
Create the month view with the initial selection on the current day.

https://bugzilla.gnome.org/show_bug.cgi?id=763149
2016-03-08 12:59:48 -03:00
Georges Basile Stavracas Neto e85e55a350 month-view: only send end_date if event is multiday 2016-02-26 21:14:23 +01:00
Georges Basile Stavracas Neto fd6d6e97c9 quick-add-popover: fix event creation again 2016-02-18 04:02:46 -02:00
Georges Basile Stavracas Neto 47bf180809 month-view: fix bottom event overflow calc
We draw a sector of height = bottom_padding * 2 + font_height,
but we calculate it wrongly. Fix that by correctly multiplying
by 2.
2016-02-18 02:08:16 -02:00
Georges Basile Stavracas Neto 1af016e2d5 month-view: use adjust hours on popover headers
If an event is from a different timezone, the headers of
the overflown popover should be translated to the current
timezone.

For example, if an event happens at 17h -0300, the translated
hour is 22h +0200. The current code already handles these
differnces, but the listbox row wasn't updated.
2016-02-18 03:42:41 +01:00
Georges Basile Stavracas Neto cc1fd4908c month-view: small style fix 2016-02-17 19:10:23 +01:00
Georges Basile Stavracas Neto d87a6e5bfd month-view: compare to adjusted dates 2016-02-17 19:09:59 +01:00
Georges Basile Stavracas Neto 4c2096ec8a subscriber-view: remove is_child_multicell() vfunc
After we added GcalEvent::is_multiday(), there is no need to
wrap it in a vfunc anymore.

To fix it, simply use is_multiday() function and get rid of the
vfunc.
2016-02-17 19:07:50 +01:00
Georges Basile Stavracas Neto 3c0c3646f4 utils: use GDateTime to build component
As part of our epic journey to GDateTime, and to
prepare ground for the future work, use GDateTime
as arguments for building the ECalComponent.
2016-02-16 11:54:35 -02:00
Georges Basile Stavracas Neto 004af2893f month-view: fix date calc on rtl languages 2016-02-16 11:27:21 +09:00
Georges Basile Stavracas Neto f39991c7c3 month-view: reallocate children when date changes
The subscriber does not add components who are already
added to the view - and doesn't need to do it. To overcome
that fact, we have to reallocate the events even when
nothing was added.

Fix that by setting the GcalSubscriberView->children_changed
to TRUE and queueing an allocation right after the date
changes.

https://bugzilla.gnome.org/show_bug.cgi?id=762066
2016-02-15 21:18:13 -02:00
Georges Basile Stavracas Neto e8647eb829 month-view: use the event's dates instead of widget's ones
Conceptually, we need to compare the event's dates to make
sure we're allocating the widgets correctly, as widget's
dates may not represent the event's ones.
2016-02-15 21:11:17 -02:00
Georges Basile Stavracas Neto 87e36adbb6 month-view: rework allocation code
GcalEventWidget added API to automatically change
the widget rendering according to the initial and
final dates. Month view, however, was still handling
it manually (and wrongly).

Fix that by reworking the allocation code, documenting
it and using the apropriate API from GcalEventWidget.
2016-02-15 20:42:47 -02:00
Georges Basile Stavracas Neto 7a6a13d7e0 event: fix timezone handling
Using libical with libecal means that the dates
are always stored as UTF dates, and we receive the
timezone as the ECalComponentDateTime::tzid value.

This fact was net being considered when adding date
support on GcalEvent, and was causing various issues
when displaying dates.

Fix that by properly handling timezones in GcalEvent.
2016-02-15 20:42:47 -02:00
Georges Basile Stavracas Neto 0ec0ea8121 event-widget: use GcalEvent internally
This saves a lot of code, and is much saner to maintain.
2016-02-14 12:17:37 -02:00
Georges Basile Stavracas Neto 7b28416361 month-view: make lines stronger
The current lines are very light and people
with visual issues may not find them easy.

To fix that, make these lines slightly stronger,
enough to make them clearly visible.

https://bugzilla.gnome.org/show_bug.cgi?id=758679
2016-01-12 17:00:07 -02:00
Georges Basile Stavracas Neto df9af0e8f9 month-view: remove leftover
This was supposed to be removed, since there's no
use in setting a state and immediately restore the
context.
2016-01-04 22:24:10 -02:00
Georges Basile Stavracas Neto 6de0376ab6 month-view: fix warnings
We were calling gtk_style_context_get() with a state
different than that of the style_context, which yiels
warnings.

Fix that by saving, setting the flag and restoring the
context.
2016-01-04 16:50:47 -02:00
Georges Basile Stavracas Neto 21f3ed1ef1 project: more css names fixups 2016-01-04 16:50:46 -02:00
Georges Basile Stavracas Neto 8b1054f638 month-view: set a css name
This will add a CSS Node in the style context,
and keep Calendar in sync with latest gtk+
upstream changes.
2016-01-04 16:27:40 -02:00
Georges Basile Stavracas Neto b6bec55185 month-view: don't show popover when clicking an invalid cell
Because we're using a simple (gint) cast to round y value of
the clicked point, a negative y was rounding to a valid cell
position and showing the popover even when the user clicked
on the blank cells before the actual month view.

Fix that by properly checking if y is negative.

https://bugzilla.gnome.org/show_bug.cgi?id=755910
2015-10-27 12:00:49 -02:00
Georges Basile Stavracas Neto 6afa9b98f6 month-view: fix mirroring macro
It was using a local variable, which is a bad idea. It
only worked because we were using it in the context of
that local variable, but it was luck.
2015-10-27 11:57:51 -02:00
Georges Basile Stavracas Neto 0c1df74735 month-view: add keyboard navigation
This big patch implements keyboard navigation for
Month view and the main window. Also, refactor
some of it's drawing code.
2015-07-15 20:40:55 -03:00
Georges Basile Stavracas Neto 5381dc77a4 month-view: update focused cell on mouse events
Also, quit selection mode when Escape is pressed
2015-06-04 13:02:47 -03:00
Georges Basile Stavracas Neto e4b5da7f50 month-view: implement keyboard navigation
For this to be made, some significant changes on the inners
of GcalMonthView had to be done. Later on, I'll do a complete
rewrite of it, deprecating the use of 'sw' and 'k'.
2015-06-04 12:48:50 -03:00
Piotr Drąg bf2eb4771c Fix minor typos in a comment 2015-06-03 21:10:59 +02:00