[gnome-calendar] utils: Rename gcal_clear_datetime to gcal_clear_date_time



commit ab1c0b6ca4aa592a457016191502216440367ea5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Apr 26 13:27:37 2019 -0300

    utils: Rename gcal_clear_datetime to gcal_clear_date_time
    
    To keep it consistent with the rest of the API.

 doc/reference/gnome-calendar-decl-list.txt    |  2 +-
 doc/reference/gnome-calendar-decl.txt         |  4 +-
 doc/reference/gnome-calendar-sections.txt     |  2 +-
 doc/reference/gnome-calendar-undocumented.txt |  2 +-
 src/gcal-application.c                        |  4 +-
 src/gcal-clock.c                              |  4 +-
 src/gcal-recurrence.c                         |  2 +-
 src/gcal-window.c                             | 14 +++----
 src/utils/gcal-date-time-utils.c              |  2 +-
 src/utils/gcal-date-time-utils.h              |  4 +-
 src/utils/gcal-utils.c                        | 59 ---------------------------
 src/utils/gcal-utils.h                        |  4 --
 src/views/gcal-month-cell.c                   |  4 +-
 src/views/gcal-month-popover.c                |  2 +-
 src/views/gcal-month-view.c                   |  4 +-
 src/views/gcal-week-grid.c                    |  8 ++--
 src/views/gcal-week-header.c                  |  8 ++--
 src/views/gcal-year-view.c                    |  8 ++--
 18 files changed, 37 insertions(+), 100 deletions(-)
---
diff --git a/doc/reference/gnome-calendar-decl-list.txt b/doc/reference/gnome-calendar-decl-list.txt
index e30e526f..c8454c4e 100644
--- a/doc/reference/gnome-calendar-decl-list.txt
+++ b/doc/reference/gnome-calendar-decl-list.txt
@@ -451,7 +451,7 @@ ICAL_TIME_TYPE
 ALIGNED
 MINUTES_PER_DAY
 MAX_MINUTES
-gcal_clear_datetime
+gcal_clear_date_time
 GcalWindowViewType
 icaltime_get_type
 datetime_compare_date
diff --git a/doc/reference/gnome-calendar-decl.txt b/doc/reference/gnome-calendar-decl.txt
index d9ceee01..8b25efcf 100644
--- a/doc/reference/gnome-calendar-decl.txt
+++ b/doc/reference/gnome-calendar-decl.txt
@@ -1026,8 +1026,8 @@ void
 #define MAX_MINUTES     (7 * MINUTES_PER_DAY)
 </MACRO>
 <MACRO>
-<NAME>gcal_clear_datetime</NAME>
-#define gcal_clear_datetime(dt) g_clear_pointer (dt, g_date_time_unref)
+<NAME>gcal_clear_date_time</NAME>
+#define gcal_clear_date_time(dt) g_clear_pointer (dt, g_date_time_unref)
 </MACRO>
 <ENUM>
 <NAME>GcalWindowViewType</NAME>
diff --git a/doc/reference/gnome-calendar-sections.txt b/doc/reference/gnome-calendar-sections.txt
index 5ae522d3..0ebd0318 100644
--- a/doc/reference/gnome-calendar-sections.txt
+++ b/doc/reference/gnome-calendar-sections.txt
@@ -465,7 +465,7 @@ ICAL_TIME_TYPE
 ALIGNED
 MINUTES_PER_DAY
 MAX_MINUTES
-gcal_clear_datetime
+gcal_clear_date_time
 GcalWindowViewType
 EventEditableProperty
 GcalTranslateFunc
diff --git a/doc/reference/gnome-calendar-undocumented.txt b/doc/reference/gnome-calendar-undocumented.txt
index 639f570b..4d3056f0 100644
--- a/doc/reference/gnome-calendar-undocumented.txt
+++ b/doc/reference/gnome-calendar-undocumented.txt
@@ -101,7 +101,7 @@ gcal_application_get_settings (<parameters>)
 gcal_application_new
 gcal_application_set_initial_date (<parameters>)
 gcal_application_set_uuid (<parameters>)
-gcal_clear_datetime (<parameters>)
+gcal_clear_date_time (<parameters>)
 gcal_date_chooser_day_get_date (<parameters>)
 gcal_date_chooser_day_new
 gcal_date_chooser_day_set_date (<parameters>)
diff --git a/src/gcal-application.c b/src/gcal-application.c
index b95b1fc0..555bccfc 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -196,7 +196,7 @@ gcal_application_finalize (GObject *object)
 
   GCAL_ENTRY;
 
-  gcal_clear_datetime (&self->initial_date);
+  gcal_clear_date_time (&self->initial_date);
   g_clear_pointer (&self->uuid, g_free);
   g_clear_object (&self->context);
   g_clear_object (&self->colors_provider);
@@ -274,7 +274,7 @@ gcal_application_activate (GApplication *application)
   if (self->initial_date)
     g_object_set (self->window, "active-date", self->initial_date, NULL);
 
-  gcal_clear_datetime (&self->initial_date);
+  gcal_clear_date_time (&self->initial_date);
 
   if (self->uuid != NULL)
     {
diff --git a/src/gcal-clock.c b/src/gcal-clock.c
index cb4afec0..affeb4fb 100644
--- a/src/gcal-clock.c
+++ b/src/gcal-clock.c
@@ -82,7 +82,7 @@ update_current_date (GcalClock *self)
 
   g_debug ("Updating clock time");
 
-  gcal_clear_datetime (&self->current);
+  gcal_clear_date_time (&self->current);
   self->current = g_date_time_ref (now);
 
   GCAL_EXIT;
@@ -194,7 +194,7 @@ gcal_clock_finalize (GObject *object)
       self->timeout_id = 0;
     }
 
-  gcal_clear_datetime (&self->current);
+  gcal_clear_date_time (&self->current);
 
   g_clear_object (&self->cancellable);
   g_clear_object (&self->proxy);
diff --git a/src/gcal-recurrence.c b/src/gcal-recurrence.c
index cc68a9b4..5a5782a0 100644
--- a/src/gcal-recurrence.c
+++ b/src/gcal-recurrence.c
@@ -30,7 +30,7 @@ gcal_recurrence_free (GcalRecurrence *self)
   g_assert (self);
   g_assert_cmpint (self->ref_count, ==, 0);
 
-  gcal_clear_datetime (&self->limit.until);
+  gcal_clear_date_time (&self->limit.until);
   g_slice_free (GcalRecurrence, self);
 }
 
diff --git a/src/gcal-window.c b/src/gcal-window.c
index d269ee3c..7d1c646b 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -320,8 +320,8 @@ update_active_date (GcalWindow *window,
 
       gcal_manager_set_subscriber (manager, E_CAL_DATA_MODEL_SUBSCRIBER (window->year_view), range_start, 
range_end);
 
-      gcal_clear_datetime (&date_start);
-      gcal_clear_datetime (&date_end);
+      gcal_clear_date_time (&date_start);
+      gcal_clear_date_time (&date_end);
     }
 
   /* month_view */
@@ -338,8 +338,8 @@ update_active_date (GcalWindow *window,
 
       gcal_manager_set_subscriber (manager, E_CAL_DATA_MODEL_SUBSCRIBER (window->month_view), range_start, 
range_end);
 
-      gcal_clear_datetime (&date_start);
-      gcal_clear_datetime (&date_end);
+      gcal_clear_date_time (&date_start);
+      gcal_clear_date_time (&date_end);
     }
 
   /* week_view */
@@ -373,8 +373,8 @@ update_active_date (GcalWindow *window,
 
       gcal_manager_set_subscriber (manager, E_CAL_DATA_MODEL_SUBSCRIBER (window->week_view), range_start, 
range_end);
 
-      gcal_clear_datetime (&date_start);
-      gcal_clear_datetime (&date_end);
+      gcal_clear_date_time (&date_start);
+      gcal_clear_date_time (&date_end);
     }
 
   update_today_button_sensitive (window);
@@ -1232,7 +1232,7 @@ gcal_window_finalize (GObject *object)
   g_clear_object (&window->context);
   g_clear_object (&window->views_switcher);
 
-  gcal_clear_datetime (&window->active_date);
+  gcal_clear_date_time (&window->active_date);
 
   G_OBJECT_CLASS (gcal_window_parent_class)->finalize (object);
 
diff --git a/src/utils/gcal-date-time-utils.c b/src/utils/gcal-date-time-utils.c
index 2f5f8079..d0fa2a92 100644
--- a/src/utils/gcal-date-time-utils.c
+++ b/src/utils/gcal-date-time-utils.c
@@ -37,7 +37,7 @@ gcal_set_date_time (GDateTime **dest,
 {
   gboolean changed = *dest != src;
 
-  gcal_clear_datetime (dest);
+  gcal_clear_date_time (dest);
 
   if (src)
     *dest = g_date_time_ref (src);
diff --git a/src/utils/gcal-date-time-utils.h b/src/utils/gcal-date-time-utils.h
index 5b930a64..652b81db 100644
--- a/src/utils/gcal-date-time-utils.h
+++ b/src/utils/gcal-date-time-utils.h
@@ -25,12 +25,12 @@
 G_BEGIN_DECLS
 
 /**
- * gcal_clear_datetime:
+ * gcal_clear_date_time:
  * @dt: location of a #GDateTime pointer
  *
  * Unreferences @dt if not %NULL, and set it to %NULL.
  */
-#define gcal_clear_datetime(dt) g_clear_pointer (dt, g_date_time_unref)
+#define gcal_clear_date_time(dt) g_clear_pointer (dt, g_date_time_unref)
 
 gboolean             gcal_set_date_time                          (GDateTime         **dest,
                                                                   GDateTime          *src);
diff --git a/src/utils/gcal-utils.c b/src/utils/gcal-utils.c
index c7646565..b146c923 100644
--- a/src/utils/gcal-utils.c
+++ b/src/utils/gcal-utils.c
@@ -634,65 +634,6 @@ icaltime_compare_with_current (const icaltimetype *date1,
   return result;
 }
 
-/**
- * get_start_of_week:
- * @date: an #icaltimetype
- *
- * Retrieves the start of the week that @date
- * falls in. This function already takes the
- * first weekday into account.
- *
- * Returns: (transfer full): a #GDateTime with
- * the start of the week.
- */
-GDateTime*
-get_start_of_week (icaltimetype *date)
-{
-  icaltimetype *new_date;
-  GDateTime *dt;
-
-  new_date = g_new0 (icaltimetype, 1);
-  *new_date = icaltime_from_day_of_year (icaltime_start_doy_week (*date, get_first_weekday () + 1),
-                                         date->year);
-  new_date->is_date = 0;
-  new_date->hour = 0;
-  new_date->minute = 0;
-  new_date->second = 0;
-
-  dt = g_date_time_new_local (new_date->year,
-                              new_date->month,
-                              new_date->day,
-                              0, 0, 0);
-
-  g_clear_pointer (&new_date, g_free);
-
-  return dt;
-}
-
-/**
- * get_end_of_week:
- * @date: an #icaltimetype
- *
- * Retrieves the end of the week that @date
- * falls in. This function already takes the
- * first weekday into account.
- *
- * Returns: (transfer full): a #GDateTime with
- * the end of the week.
- */
-GDateTime*
-get_end_of_week (icaltimetype *date)
-{
-  GDateTime *week_start, *week_end;
-
-  week_start = get_start_of_week (date);
-  week_end = g_date_time_add_days (week_start, 7);
-
-  g_clear_pointer (&week_start, g_date_time_unref);
-
-  return week_end;
-}
-
 /**
  * is_clock_format_24h:
  *
diff --git a/src/utils/gcal-utils.h b/src/utils/gcal-utils.h
index 6691317e..6701f6b9 100644
--- a/src/utils/gcal-utils.h
+++ b/src/utils/gcal-utils.h
@@ -87,10 +87,6 @@ gint                 icaltime_compare_with_current               (const icaltime
                                                                   const icaltimetype *date2,
                                                                   time_t             *current_time_t);
 
-GDateTime*           get_start_of_week                           (icaltimetype       *date);
-
-GDateTime*           get_end_of_week                             (icaltimetype       *date);
-
 gboolean             is_clock_format_24h                         (void);
 
 /* code brought from evolution */
diff --git a/src/views/gcal-month-cell.c b/src/views/gcal-month-cell.c
index bc63c84c..58bcf3e1 100644
--- a/src/views/gcal-month-cell.c
+++ b/src/views/gcal-month-cell.c
@@ -347,7 +347,7 @@ gcal_month_cell_finalize (GObject *object)
 {
   GcalMonthCell *self = (GcalMonthCell *)object;
 
-  gcal_clear_datetime (&self->date);
+  gcal_clear_date_time (&self->date);
   g_clear_object (&self->context);
 
   G_OBJECT_CLASS (gcal_month_cell_parent_class)->finalize (object);
@@ -483,7 +483,7 @@ gcal_month_cell_set_date (GcalMonthCell *self,
   if (self->date && date && datetime_compare_date (self->date, date) == 0)
     return;
 
-  gcal_clear_datetime (&self->date);
+  gcal_clear_date_time (&self->date);
   self->date = g_date_time_ref (date);
 
   /* Day label */
diff --git a/src/views/gcal-month-popover.c b/src/views/gcal-month-popover.c
index e2b218ab..957b72e6 100644
--- a/src/views/gcal-month-popover.c
+++ b/src/views/gcal-month-popover.c
@@ -881,7 +881,7 @@ gcal_month_popover_set_date (GcalMonthPopover *self,
   if (date && self->date && datetime_compare_date (self->date, date) == 0)
     return;
 
-  gcal_clear_datetime (&self->date);
+  gcal_clear_date_time (&self->date);
 
   if (date)
     {
diff --git a/src/views/gcal-month-view.c b/src/views/gcal-month-view.c
index e4a51fe7..39812481 100644
--- a/src/views/gcal-month-view.c
+++ b/src/views/gcal-month-view.c
@@ -2090,7 +2090,7 @@ gcal_month_view_scroll_event (GtkWidget      *widget,
       diff = self->scroll_value > 0 ? 1 : -1;
       new_date = g_date_time_add_months (self->date, diff);
 
-      gcal_clear_datetime (&self->date);
+      gcal_clear_date_time (&self->date);
       self->date = g_steal_pointer (&new_date);
       self->scroll_value = 0;
 
@@ -2179,7 +2179,7 @@ gcal_month_view_finalize (GObject *object)
 {
   GcalMonthView *self = GCAL_MONTH_VIEW (object);
 
-  gcal_clear_datetime (&self->date);
+  gcal_clear_date_time (&self->date);
   g_clear_pointer (&self->children, g_hash_table_destroy);
   g_clear_pointer (&self->single_cell_children, g_hash_table_destroy);
   g_clear_pointer (&self->overflow_cells, g_hash_table_destroy);
diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c
index d45e12b0..adc8b4ae 100644
--- a/src/views/gcal-week-grid.c
+++ b/src/views/gcal-week-grid.c
@@ -273,7 +273,7 @@ gcal_week_grid_finalize (GObject *object)
   GcalWeekGrid *self = GCAL_WEEK_GRID (object);
 
   g_clear_pointer (&self->events, gcal_range_tree_unref);
-  gcal_clear_datetime (&self->active_date);
+  gcal_clear_date_time (&self->active_date);
 
   G_OBJECT_CLASS (gcal_week_grid_parent_class)->finalize (object);
 }
@@ -909,9 +909,9 @@ gcal_week_grid_button_release (GtkWidget      *widget,
                          (gdouble) out_x,
                          (gdouble) out_y);
 
-  gcal_clear_datetime (&week_start);
-  gcal_clear_datetime (&start);
-  gcal_clear_datetime (&end);
+  gcal_clear_date_time (&week_start);
+  gcal_clear_date_time (&start);
+  gcal_clear_date_time (&end);
 
   return GDK_EVENT_STOP;
 }
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index c1932d8f..78884a49 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -1157,7 +1157,7 @@ gcal_week_header_finalize (GObject *object)
   GcalWeekHeader *self = GCAL_WEEK_HEADER (object);
   gint i;
 
-  gcal_clear_datetime (&self->active_date);
+  gcal_clear_date_time (&self->active_date);
 
   for (i = 0; i < 7; i++)
     g_list_free (self->events[i]);
@@ -1762,11 +1762,11 @@ gcal_week_header_add_event (GcalWeekHeader *self,
        */
       aux = week_start;
       week_start = utc_week_start;
-      gcal_clear_datetime (&aux);
+      gcal_clear_date_time (&aux);
 
       aux = week_end;
       week_end = utc_week_end;
-      gcal_clear_datetime (&aux);
+      gcal_clear_date_time (&aux);
 
     }
   else
@@ -1932,6 +1932,6 @@ gcal_week_header_set_date (GcalWeekHeader *self,
 
   update_weather_infos (self);
 
-  gcal_clear_datetime (&old_date);
+  gcal_clear_date_time (&old_date);
 }
 
diff --git a/src/views/gcal-year-view.c b/src/views/gcal-year-view.c
index 9c725a8f..c117cfe1 100644
--- a/src/views/gcal-year-view.c
+++ b/src/views/gcal-year-view.c
@@ -214,13 +214,13 @@ update_selected_dates_from_button_data (GcalYearView *year_view)
 
       order_selected_data (&selected_data);
 
-      gcal_clear_datetime (&year_view->start_selected_date);
+      gcal_clear_date_time (&year_view->start_selected_date);
       year_view->start_selected_date = g_date_time_new_local (g_date_time_get_year (year_view->date),
                                                               selected_data.start_month + 1,
                                                               selected_data.start_day,
                                                               0, 0, 0);
 
-      gcal_clear_datetime (&year_view->end_selected_date);
+      gcal_clear_date_time (&year_view->end_selected_date);
       year_view->end_selected_date = g_date_time_new_local (g_date_time_get_year (year_view->date),
                                                             selected_data.start_month + 1,
                                                             selected_data.start_day,
@@ -235,14 +235,14 @@ update_selected_dates_from_button_data (GcalYearView *year_view)
       else
         start_date = g_date_time_new_now_local ();
 
-      gcal_clear_datetime (&year_view->start_selected_date);
+      gcal_clear_date_time (&year_view->start_selected_date);
       year_view->start_selected_date = g_date_time_new (gcal_context_get_timezone (year_view->context),
                                                         g_date_time_get_year (start_date),
                                                         g_date_time_get_month (start_date),
                                                         g_date_time_get_day_of_month (start_date),
                                                         0, 0, 0);
 
-      gcal_clear_datetime (&year_view->end_selected_date);
+      gcal_clear_date_time (&year_view->end_selected_date);
       year_view->end_selected_date = g_date_time_add_days (year_view->start_selected_date, 1);
 
       year_view->selected_data->start_day = g_date_time_get_day_of_month (year_view->start_selected_date);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]