Whitespace changes

This commit is contained in:
Florian Brosch
2017-12-11 22:13:16 -02:00
committed by Georges Basile Stavracas Neto
parent d51d1ea2cd
commit eceb826e77
14 changed files with 1275 additions and 1370 deletions
+33 -33
View File
@@ -38,70 +38,70 @@
typedef struct typedef struct
{ {
GcalEvent *event; GcalEvent *event;
GcalManager *manager; GcalManager *manager;
} AsyncOpsData; } AsyncOpsData;
typedef struct typedef struct
{ {
ECalDataModelSubscriber *subscriber; ECalDataModelSubscriber *subscriber;
gchar *query; gchar *query;
guint sources_left; guint sources_left;
gboolean passed_start; gboolean passed_start;
gboolean search_done; gboolean search_done;
} ViewStateData; } ViewStateData;
typedef struct typedef struct
{ {
ECalClient *client; ECalClient *client;
gboolean connected; gboolean connected;
} GcalManagerUnit; } GcalManagerUnit;
typedef struct typedef struct
{ {
gchar *event_uid; gchar *event_uid;
GcalManagerUnit *unit; GcalManagerUnit *unit;
GcalManagerUnit *new_unit; GcalManagerUnit *new_unit;
ECalComponent *new_component; ECalComponent *new_component;
GcalManager *manager; GcalManager *manager;
} MoveEventData; } MoveEventData;
struct _GcalManager struct _GcalManager
{ {
GObject parent; GObject parent;
/** /**
* The list of clients we are managing. * The list of clients we are managing.
* Each value is of type GCalStoreUnit * Each value is of type GCalStoreUnit
* And each key is the source uid * And each key is the source uid
*/ */
GHashTable *clients; GHashTable *clients;
ESourceRegistry *source_registry; ESourceRegistry *source_registry;
ECredentialsPrompter *credentials_prompter; ECredentialsPrompter *credentials_prompter;
ECalDataModel *e_data_model; ECalDataModel *e_data_model;
ECalDataModel *search_data_model; ECalDataModel *search_data_model;
ECalDataModel *shell_search_data_model; ECalDataModel *shell_search_data_model;
ViewStateData *search_view_data; ViewStateData *search_view_data;
GCancellable *async_ops; GCancellable *async_ops;
GoaClient *goa_client; GoaClient *goa_client;
GcalClock *clock; GcalClock *clock;
/* state flags */ /* state flags */
gboolean goa_client_ready; gboolean goa_client_ready;
gint sources_at_launch; gint sources_at_launch;
/* timezone */ /* timezone */
icaltimezone *system_timezone; icaltimezone *system_timezone;
/* property */ /* property */
GSettings *settings; GSettings *settings;
}; };
G_DEFINE_TYPE (GcalManager, gcal_manager, G_TYPE_OBJECT) G_DEFINE_TYPE (GcalManager, gcal_manager, G_TYPE_OBJECT)
@@ -131,12 +131,12 @@ static GParamSpec *properties[NUM_PROPS] = { NULL, };
/* -- start: threading related code provided by Milan Crha */ /* -- start: threading related code provided by Milan Crha */
typedef struct { typedef struct {
EThreadJobFunc func; EThreadJobFunc func;
gpointer user_data; gpointer user_data;
GDestroyNotify free_user_data; GDestroyNotify free_user_data;
GCancellable *cancellable; GCancellable *cancellable;
GError *error; GError *error;
} ThreadJobData; } ThreadJobData;
static void static void
@@ -175,7 +175,7 @@ thread_job_thread (gpointer user_data)
return g_thread_self (); return g_thread_self ();
} }
static GCancellable * static GCancellable*
submit_thread_job (EThreadJobFunc func, submit_thread_job (EThreadJobFunc func,
gpointer user_data, gpointer user_data,
GDestroyNotify free_user_data) GDestroyNotify free_user_data)
+14 -14
View File
@@ -35,10 +35,10 @@ typedef struct
struct _GcalSearchView struct _GcalSearchView
{ {
GtkPopover parent; GtkPopover parent;
GtkWidget *listbox; GtkWidget *listbox;
GtkWidget *stack; GtkWidget *stack;
/* Since the user can have (literally) /* Since the user can have (literally)
* thousands of events, the usage of * thousands of events, the usage of
@@ -46,23 +46,23 @@ struct _GcalSearchView
* the RowEventData lookup constant * the RowEventData lookup constant
* time. * time.
*/ */
GHashTable *uuid_to_event; GHashTable *uuid_to_event;
/* misc */ /* misc */
gint no_results_timeout_id; gint no_results_timeout_id;
gint num_results; gint num_results;
gchar *field; gchar *field;
gchar *query; gchar *query;
time_t current_utc_date; time_t current_utc_date;
guint search_timeout_id; guint search_timeout_id;
/* property */ /* property */
icaltimetype *date; icaltimetype *date;
GcalManager *manager; /* weak reference */ GcalManager *manager; /* weak reference */
/* flags */ /* flags */
gboolean format_24h; gboolean format_24h;
gboolean subscribed; gboolean subscribed;
}; };
enum enum
+14 -37
View File
@@ -31,9 +31,9 @@
*/ */
typedef struct _GcalTimer typedef struct _GcalTimer
{ {
GSource parent; GSource parent;
gint64 last_event; gint64 last_event;
gint64 default_duration; gint64 default_duration;
} GcalTimer; } GcalTimer;
@@ -48,25 +48,24 @@ typedef struct _GcalTimer
*/ */
typedef struct typedef struct
{ {
GcalTimer *timer; /* unowned */ GcalTimer *timer; /* unowned */
GCalTimerFunc callback; GCalTimerFunc callback;
GDestroyNotify destroy_notify; GDestroyNotify destroy_notify;
gpointer data; gpointer data;
} CbWrapperData; } CbWrapperData;
static void timer_func_destroy_notify_wrapper (CbWrapperData *wrapper); static void timer_func_destroy_notify_wrapper (CbWrapperData *wrapper);
static gboolean timer_func_wrapper (CbWrapperData *wrapper); static gboolean timer_func_wrapper (CbWrapperData *wrapper);
static gboolean timer_source_dispatch (GcalTimer *self, static gboolean timer_source_dispatch (GcalTimer *self,
GSourceFunc callback, GSourceFunc callback,
CbWrapperData *user_data); CbWrapperData *user_data);
static void schedule_next (GcalTimer *self); static void schedule_next (GcalTimer *self);
static void timer_source_finalize (GcalTimer *self);
static void timer_source_finalize (GcalTimer *self);
@@ -82,8 +81,6 @@ timer_func_destroy_notify_wrapper (CbWrapperData *wrapper)
g_free (wrapper); g_free (wrapper);
} }
static gboolean static gboolean
timer_func_wrapper (CbWrapperData *wrapper) timer_func_wrapper (CbWrapperData *wrapper)
{ {
@@ -95,8 +92,6 @@ timer_func_wrapper (CbWrapperData *wrapper)
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }
static gboolean static gboolean
timer_source_dispatch (GcalTimer *self, timer_source_dispatch (GcalTimer *self,
GSourceFunc user_callback, GSourceFunc user_callback,
@@ -115,8 +110,6 @@ timer_source_dispatch (GcalTimer *self,
return result; return result;
} }
static void static void
schedule_next (GcalTimer *self) schedule_next (GcalTimer *self)
{ {
@@ -135,8 +128,6 @@ schedule_next (GcalTimer *self)
g_source_set_ready_time ((GSource*) self, 0); g_source_set_ready_time ((GSource*) self, 0);
} }
static void static void
timer_source_finalize (GcalTimer *self) timer_source_finalize (GcalTimer *self)
{ {
@@ -182,8 +173,6 @@ gcal_timer_new (gint64 default_duration)
return g_steal_pointer (&self); return g_steal_pointer (&self);
} }
/** /**
* gcal_timer_set_start: * gcal_timer_set_start:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -200,8 +189,6 @@ gcal_timer_start (GcalTimer *self)
schedule_next (self); schedule_next (self);
} }
/** /**
* gcal_timer_set_reset: * gcal_timer_set_reset:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -218,8 +205,6 @@ gcal_timer_reset (GcalTimer *self)
schedule_next (self); schedule_next (self);
} }
/** /**
* gcal_timer_set_stop: * gcal_timer_set_stop:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -235,8 +220,6 @@ gcal_timer_stop (GcalTimer *self)
g_source_set_ready_time ((GSource*) self, -1); g_source_set_ready_time ((GSource*) self, -1);
} }
/** /**
* gcal_timer_is_running * gcal_timer_is_running
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -251,8 +234,6 @@ gcal_timer_is_running (GcalTimer *self)
return g_source_get_ready_time ((GSource*) self) >= 0; return g_source_get_ready_time ((GSource*) self) >= 0;
} }
/** /**
* gcal_timer_set_duration: * gcal_timer_set_duration:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -280,8 +261,6 @@ gcal_timer_set_default_duration (GcalTimer *self,
schedule_next (self); schedule_next (self);
} }
/** /**
* gcal_timer_get_default_duration: * gcal_timer_get_default_duration:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -296,7 +275,6 @@ gcal_timer_get_default_duration (GcalTimer *self)
return self->default_duration; return self->default_duration;
} }
/** /**
* gcal_timer_set_callback: * gcal_timer_set_callback:
* @self: The #GcalTimer. * @self: The #GcalTimer.
@@ -330,7 +308,6 @@ gcal_timer_set_callback (GcalTimer *self,
(GDestroyNotify) timer_func_destroy_notify_wrapper); (GDestroyNotify) timer_func_destroy_notify_wrapper);
} }
/** /**
* gcal_timer_free: * gcal_timer_free:
* @self: The #GcalTimer. * @self: The #GcalTimer.
+13 -13
View File
@@ -28,27 +28,27 @@ typedef struct _GcalTimer GcalTimer;
typedef void (*GCalTimerFunc) (GcalTimer *self, gpointer data); typedef void (*GCalTimerFunc) (GcalTimer *self, gpointer data);
GcalTimer* gcal_timer_new (gint64 default_duration); GcalTimer* gcal_timer_new (gint64 default_duration);
void gcal_timer_start (GcalTimer *self); void gcal_timer_start (GcalTimer *self);
void gcal_timer_reset (GcalTimer *self); void gcal_timer_reset (GcalTimer *self);
void gcal_timer_stop (GcalTimer *self); void gcal_timer_stop (GcalTimer *self);
gboolean gcal_timer_is_running (GcalTimer *self); gboolean gcal_timer_is_running (GcalTimer *self);
void gcal_timer_set_default_duration (GcalTimer *self, void gcal_timer_set_default_duration (GcalTimer *self,
gint64 duration); gint64 duration);
gint64 gcal_timer_get_default_duration (GcalTimer *self); gint64 gcal_timer_get_default_duration (GcalTimer *self);
void gcal_timer_set_callback (GcalTimer *self, void gcal_timer_set_callback (GcalTimer *self,
GCalTimerFunc func, GCalTimerFunc func,
gpointer data, gpointer data,
GDestroyNotify notify); GDestroyNotify notify);
void gcal_timer_free (GcalTimer *self); void gcal_timer_free (GcalTimer *self);
#endif /* __GCAL_TIMER_H__ */ #endif /* __GCAL_TIMER_H__ */
+64 -63
View File
@@ -70,99 +70,100 @@ typedef enum
GCAL_WEEK_DAY_SATURDAY = 1 << 6 GCAL_WEEK_DAY_SATURDAY = 1 << 6
} GcalWeekDay; } GcalWeekDay;
GType icaltime_get_type (void) G_GNUC_CONST; GType icaltime_get_type (void) G_GNUC_CONST;
gint datetime_compare_date (GDateTime *dt1, gint datetime_compare_date (GDateTime *dt1,
GDateTime *dt2); GDateTime *dt2);
icaltimetype* datetime_to_icaltime (GDateTime *dt); icaltimetype* datetime_to_icaltime (GDateTime *dt);
gboolean datetime_is_date (GDateTime *dt); gboolean datetime_is_date (GDateTime *dt);
GDateTime* icaltime_to_datetime (const icaltimetype *date); GDateTime* icaltime_to_datetime (const icaltimetype *date);
icaltimetype* gcal_dup_icaltime (const icaltimetype *date); icaltimetype* gcal_dup_icaltime (const icaltimetype *date);
gchar* gcal_get_weekday (gint i); gchar* gcal_get_weekday (gint i);
gchar* gcal_get_month_name (gint i); gchar* gcal_get_month_name (gint i);
cairo_surface_t*gcal_get_surface_from_color (GdkRGBA *color, cairo_surface_t* gcal_get_surface_from_color (GdkRGBA *color,
gint size); gint size);
cairo_surface_t*get_circle_surface_from_color (GdkRGBA *color, cairo_surface_t* get_circle_surface_from_color (GdkRGBA *color,
gint size); gint size);
void get_color_name_from_source (ESource *source, void get_color_name_from_source (ESource *source,
GdkRGBA *out_color); GdkRGBA *out_color);
gchar* get_desc_from_component (ECalComponent *component, gchar* get_desc_from_component (ECalComponent *component,
const gchar *joint_char); const gchar *joint_char);
gchar* get_uuid_from_component (ESource *source, gchar* get_uuid_from_component (ESource *source,
ECalComponent *component); ECalComponent *component);
gint get_first_weekday (void); gint get_first_weekday (void);
ECalComponent* build_component_from_details (const gchar *summary, ECalComponent* build_component_from_details (const gchar *summary,
GDateTime *initial_date, GDateTime *initial_date,
GDateTime *final_date); GDateTime *final_date);
gint icaltime_compare_date (const icaltimetype *date1, gint icaltime_compare_date (const icaltimetype *date1,
const icaltimetype *date2); const icaltimetype *date2);
gint icaltime_compare_with_current (const icaltimetype *date1, gint icaltime_compare_with_current (const icaltimetype *date1,
const icaltimetype *date2, const icaltimetype *date2,
time_t *current_time_t); time_t *current_time_t);
GDateTime* get_start_of_week (icaltimetype *date); GDateTime* get_start_of_week (icaltimetype *date);
GDateTime* get_end_of_week (icaltimetype *date); GDateTime* get_end_of_week (icaltimetype *date);
gboolean is_clock_format_24h (void); gboolean is_clock_format_24h (void);
/* code brought from evolution */ /* code brought from evolution */
gsize e_strftime_fix_am_pm (gchar *str, gsize e_strftime_fix_am_pm (gchar *str,
gsize max, gsize max,
const gchar *fmt, const gchar *fmt,
const struct tm *tm); const struct tm *tm);
gsize e_utf8_strftime_fix_am_pm (gchar *str,
gsize max, gsize e_utf8_strftime_fix_am_pm (gchar *str,
const gchar *fmt, gsize max,
const struct tm *tm); const gchar *fmt,
const struct tm *tm);
void fix_popover_menu_icons (GtkPopover *popover); void fix_popover_menu_icons (GtkPopover *popover);
void get_source_parent_name_color (GcalManager *manager,
ESource *source,
gchar **name,
gchar **color);
gchar* format_utc_offset (gint64 offset); void get_source_parent_name_color (GcalManager *manager,
ESource *source,
gchar **name,
gchar **color);
gint get_alarm_trigger_minutes (GcalEvent *event, gchar* format_utc_offset (gint64 offset);
ECalComponentAlarm *alarm);
gboolean should_change_date_for_scroll (gdouble *scroll_value, gint get_alarm_trigger_minutes (GcalEvent *event,
GdkEventScroll *scroll_event); ECalComponentAlarm *alarm);
gboolean is_source_enabled (ESource *source); gboolean should_change_date_for_scroll (gdouble *scroll_value,
GdkEventScroll *scroll_event);
gboolean ask_recurrence_modification_type (GtkWidget *parent, gboolean is_source_enabled (ESource *source);
GcalRecurrenceModType *modtype,
ESource *source);
gboolean is_workday (guint day); gboolean ask_recurrence_modification_type (GtkWidget *parent,
GcalRecurrenceModType *modtype,
ESource *source);
GList* filter_event_list_by_uid_and_modtype (GList *widgets, gboolean is_workday (guint day);
GcalRecurrenceModType mod,
const gchar *uid);
gboolean gcal_translate_child_window_position (GtkWidget *target, GList* filter_event_list_by_uid_and_modtype (GList *widgets,
GdkWindow *child_window, GcalRecurrenceModType mod,
gdouble src_x, const gchar *uid);
gdouble src_y,
gdouble *real_x, gboolean gcal_translate_child_window_position (GtkWidget *target,
gdouble *real_y); GdkWindow *child_window,
gdouble src_x,
gdouble src_y,
gdouble *real_x,
gdouble *real_y);
#endif /* __GCAL_UTILS_H__ */ #endif /* __GCAL_UTILS_H__ */
+11 -28
View File
@@ -21,15 +21,6 @@
#include <string.h> #include <string.h>
#include "gcal-weather-info.h" #include "gcal-weather-info.h"
static void gcal_weather_info_set_date (GcalWeatherInfo *self,
GDate *date);
static void gcal_weather_info_set_temperature (GcalWeatherInfo *self,
const gchar *temperature);
static void gcal_weather_info_set_icon_name (GcalWeatherInfo *self,
const gchar *icon_name);
/* _GcalWeatherInfo: /* _GcalWeatherInfo:
* @date: (not nullable): The day this information belongs to. * @date: (not nullable): The day this information belongs to.
@@ -51,6 +42,15 @@ struct _GcalWeatherInfo {
}; };
static void gcal_weather_info_set_date (GcalWeatherInfo *self,
GDate *date);
static void gcal_weather_info_set_temperature (GcalWeatherInfo *self,
const gchar *temperature);
static void gcal_weather_info_set_icon_name (GcalWeatherInfo *self,
const gchar *icon_name);
G_DEFINE_TYPE (GcalWeatherInfo, gcal_weather_info, G_TYPE_OBJECT) G_DEFINE_TYPE (GcalWeatherInfo, gcal_weather_info, G_TYPE_OBJECT)
enum { enum {
@@ -79,8 +79,6 @@ gcal_weather_info_finalize (GObject *object)
G_OBJECT_CLASS (gcal_weather_info_parent_class)->finalize (object); G_OBJECT_CLASS (gcal_weather_info_parent_class)->finalize (object);
} }
static void static void
gcal_weather_info_get_property (GObject *object, gcal_weather_info_get_property (GObject *object,
guint property_id, guint property_id,
@@ -107,8 +105,6 @@ gcal_weather_info_get_property (GObject *object,
} }
} }
static void static void
gcal_weather_info_set_property (GObject *object, gcal_weather_info_set_property (GObject *object,
guint property_id, guint property_id,
@@ -138,8 +134,6 @@ gcal_weather_info_set_property (GObject *object,
} }
} }
static void static void
gcal_weather_info_class_init (GcalWeatherInfoClass *klass) gcal_weather_info_class_init (GcalWeatherInfoClass *klass)
{ {
@@ -185,8 +179,6 @@ gcal_weather_info_class_init (GcalWeatherInfoClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
} }
static void static void
gcal_weather_info_init (GcalWeatherInfo *self) gcal_weather_info_init (GcalWeatherInfo *self)
{ {
@@ -215,8 +207,6 @@ gcal_weather_info_set_date (GcalWeatherInfo *self,
self->date = *date; self->date = *date;
} }
/* gcal_weather_info_set_temperature: /* gcal_weather_info_set_temperature:
* @self: A #GcalWeatherInfo instance. * @self: A #GcalWeatherInfo instance.
* @temperature: A weather string. * @temperature: A weather string.
@@ -238,9 +228,7 @@ gcal_weather_info_set_temperature (GcalWeatherInfo *self,
} }
} }
/* gcal_weather_info_set_icon_name:
/* gcal_weather_info_set_icon_name:
* @self: A #GcalWeatherInfo instance. * @self: A #GcalWeatherInfo instance.
* @icon_name: The name of the icon to display. * @icon_name: The name of the icon to display.
* *
@@ -262,6 +250,7 @@ gcal_weather_info_set_icon_name (GcalWeatherInfo *self,
} }
/* < public > */ /* < public > */
/** /**
@@ -293,8 +282,6 @@ gcal_weather_info_new (GDate *date,
return info; return info;
} }
/** /**
* gcal_weather_info_get_date: * gcal_weather_info_get_date:
* @self: A #GcalWeatherInfo instance. * @self: A #GcalWeatherInfo instance.
@@ -311,8 +298,6 @@ gcal_weather_info_get_date (GcalWeatherInfo *self,
*date = self->date; *date = self->date;
} }
/** /**
* gcal_weather_info_get_icon_name: * gcal_weather_info_get_icon_name:
* @self: A #GcalWeatherInfo instance. * @self: A #GcalWeatherInfo instance.
@@ -327,8 +312,6 @@ gcal_weather_info_get_icon_name (GcalWeatherInfo *self)
return self->icon_name; return self->icon_name;
} }
/** /**
* gcal_weather_info_get_temperature: * gcal_weather_info_get_temperature:
* @self: A #GcalWeatherInfo instance. * @self: A #GcalWeatherInfo instance.
+9 -9
View File
@@ -30,19 +30,19 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GcalWeatherInfo, gcal_weather_info, GCAL, WEATHER_INFO, GObject) G_DECLARE_FINAL_TYPE (GcalWeatherInfo, gcal_weather_info, GCAL, WEATHER_INFO, GObject)
GcalWeatherInfo* gcal_weather_info_new (GDate *date, GcalWeatherInfo* gcal_weather_info_new (GDate *date,
const gchar *icon_name, const gchar *icon_name,
const gchar *temperature); const gchar *temperature);
void gcal_weather_info_get_date (GcalWeatherInfo *self, void gcal_weather_info_get_date (GcalWeatherInfo *self,
GDate *date); GDate *date);
void gcal_weather_info_get_date (GcalWeatherInfo *self, void gcal_weather_info_get_date (GcalWeatherInfo *self,
GDate *date); GDate *date);
const gchar* gcal_weather_info_get_icon_name (GcalWeatherInfo *self); const gchar* gcal_weather_info_get_icon_name (GcalWeatherInfo *self);
const gchar* gcal_weather_info_get_temperature (GcalWeatherInfo *self); const gchar* gcal_weather_info_get_temperature (GcalWeatherInfo *self);
G_END_DECLS G_END_DECLS
+915 -972
View File
File diff suppressed because it is too large Load Diff
+18 -20
View File
@@ -37,37 +37,35 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GcalWeatherService, gcal_weather_service, GCAL, WEATHER_SERVICE, GObject) G_DECLARE_FINAL_TYPE (GcalWeatherService, gcal_weather_service, GCAL, WEATHER_SERVICE, GObject)
GcalWeatherService* gcal_weather_service_new (GTimeZone *time_zone, GcalWeatherService* gcal_weather_service_new (GTimeZone *time_zone,
guint max_days, guint max_days,
guint check_interval_new, guint check_interval_new,
guint check_interval_renew, guint check_interval_renew,
gint64 valid_timespan); gint64 valid_timespan);
GTimeZone* gcal_weather_service_get_time_zone (GcalWeatherService *self); GTimeZone* gcal_weather_service_get_time_zone (GcalWeatherService *self);
void gcal_weather_service_set_time_zone (GcalWeatherService *self, void gcal_weather_service_set_time_zone (GcalWeatherService *self,
GTimeZone *value); GTimeZone *value);
void gcal_weather_service_run (GcalWeatherService *self, guint gcal_weather_service_get_max_days (GcalWeatherService *self);
GWeatherLocation *location);
void gcal_weather_service_stop (GcalWeatherService *self); gint64 gcal_weather_service_get_valid_timespan (GcalWeatherService *self);
guint gcal_weather_service_get_max_days (GcalWeatherService *self); guint gcal_weather_service_get_check_interval_new (GcalWeatherService *self);
gint64 gcal_weather_service_get_valid_timespan (GcalWeatherService *self); guint gcal_weather_service_get_check_interval_renew (GcalWeatherService *self);
guint gcal_weather_service_get_check_interval_new GSList* gcal_weather_service_get_weather_infos (GcalWeatherService *self);
(GcalWeatherService *self);
guint gcal_weather_service_get_check_interval_renew const gchar* gcal_weather_service_get_attribution (GcalWeatherService *self);
(GcalWeatherService *self);
GSList* gcal_weather_service_get_weather_infos (GcalWeatherService *self); void gcal_weather_service_update (GcalWeatherService *self);
const gchar* gcal_weather_service_get_attribution (GcalWeatherService *self); void gcal_weather_service_run (GcalWeatherService *self,
GWeatherLocation *location);
void gcal_weather_service_update (GcalWeatherService *self); void gcal_weather_service_stop (GcalWeatherService *self);
G_END_DECLS G_END_DECLS
+98 -98
View File
@@ -84,16 +84,16 @@
typedef struct typedef struct
{ {
gint x; gint x;
gint y; gint y;
GDateTime *start_date; GDateTime *start_date;
GDateTime *end_date; GDateTime *end_date;
} NewEventData; } NewEventData;
typedef struct typedef struct
{ {
GcalWindow *window; GcalWindow *window;
gchar *uuid; gchar *uuid;
} OpenEditDialogData; } OpenEditDialogData;
/* WeatherSigs: /* WeatherSigs:
@@ -107,8 +107,8 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
GObject *obj; /* unowned */ GObject *obj; /* unowned */
gulong id; gulong id;
} WeatherSigs; } WeatherSigs;
struct _GcalWindow struct _GcalWindow
@@ -116,86 +116,86 @@ struct _GcalWindow
GtkApplicationWindow parent; GtkApplicationWindow parent;
/* timeout ids */ /* timeout ids */
guint notification_timeout; guint notification_timeout;
/* upper level widgets */ /* upper level widgets */
GtkWidget *main_box; GtkWidget *main_box;
GtkWidget *header_bar; GtkWidget *header_bar;
GtkWidget *search_bar; GtkWidget *search_bar;
GtkWidget *views_overlay; GtkWidget *views_overlay;
GtkWidget *views_stack; GtkWidget *views_stack;
GtkWidget *week_view; GtkWidget *week_view;
GtkWidget *month_view; GtkWidget *month_view;
GtkWidget *year_view; GtkWidget *year_view;
GtkWidget *notification; GtkWidget *notification;
GtkWidget *notification_label; GtkWidget *notification_label;
GtkWidget *notification_action_button; GtkWidget *notification_action_button;
GtkWidget *notification_close_button; GtkWidget *notification_close_button;
/* header_bar widets */ /* header_bar widets */
GtkWidget *menu_button; GtkWidget *menu_button;
GtkWidget *search_button; GtkWidget *search_button;
GtkWidget *calendars_button; GtkWidget *calendars_button;
GtkWidget *search_entry; GtkWidget *search_entry;
GtkWidget *back_button; GtkWidget *back_button;
GtkWidget *today_button; GtkWidget *today_button;
GtkWidget *forward_button; GtkWidget *forward_button;
GtkWidget *views_switcher; GtkWidget *views_switcher;
/* new event popover widgets */ /* new event popover widgets */
GtkWidget *quick_add_popover; GtkWidget *quick_add_popover;
GtkWidget *search_view; GtkWidget *search_view;
/* day, week, month, year, list */ /* day, week, month, year, list */
GtkWidget *views [6]; GtkWidget *views [6];
GtkWidget *edit_dialog; GtkWidget *edit_dialog;
GcalManager *manager; GcalManager *manager;
GcalWindowViewType active_view; GcalWindowViewType active_view;
icaltimetype *active_date; icaltimetype *active_date;
gboolean rtl; gboolean rtl;
/* states */ /* states */
gboolean new_event_mode; gboolean new_event_mode;
gboolean search_mode; gboolean search_mode;
NewEventData *event_creation_data; NewEventData *event_creation_data;
GcalEvent *event_to_delete; GcalEvent *event_to_delete;
GcalRecurrenceModType event_to_delete_mod; GcalRecurrenceModType event_to_delete_mod;
/* calendar management */ /* calendar management */
GtkWidget *calendar_popover; GtkWidget *calendar_popover;
GtkWidget *calendar_listbox; GtkWidget *calendar_listbox;
GtkWidget *source_dialog; GtkWidget *source_dialog;
gint refresh_timeout; gint refresh_timeout;
gint refresh_timeout_id; gint refresh_timeout_id;
gint open_edit_dialog_timeout_id; gint open_edit_dialog_timeout_id;
/* weather management */ /* weather management */
GcalWeatherService *weather_service; /* owned */ GcalWeatherService *weather_service; /* owned */
GtkSwitch *weather; /* unowned */ GtkSwitch *weather; /* unowned */
GtkSwitch *auto_location; /* unowned */ GtkSwitch *auto_location; /* unowned */
GtkBox *auto_location_box; /* unowned */ GtkBox *auto_location_box; /* unowned */
GWeatherLocationEntry *location_entry; /* unowned */ GWeatherLocationEntry *location_entry; /* unowned */
WeatherSigs weather_cb_ids[5]; WeatherSigs weather_cb_ids[5];
/* temp to keep event_creation */ /* temp to keep event_creation */
gboolean open_edit_dialog; gboolean open_edit_dialog;
/* handler for the searh_view */ /* handler for the searh_view */
gint click_outside_handler_id; gint click_outside_handler_id;
/* Window states */ /* Window states */
gint width; gint width;
gint height; gint height;
gint pos_x; gint pos_x;
gint pos_y; gint pos_y;
gboolean is_maximized; gboolean is_maximized;
}; };
enum enum
@@ -218,60 +218,60 @@ enum
} }
static void on_show_calendars_action_activated (GSimpleAction *action, static void on_show_calendars_action_activated (GSimpleAction *action,
GVariant *param, GVariant *param,
gpointer user_data); gpointer user_data);
static void on_view_action_activated (GSimpleAction *action, static void on_view_action_activated (GSimpleAction *action,
GVariant *param, GVariant *param,
gpointer user_data); gpointer user_data);
static void on_toggle_search_bar_activated (GSimpleAction *action, static void on_menu_button_clicked (GtkMenuButton *menu,
GVariant *param, GtkStack *stack);
gpointer user_data);
static void on_menu_button_clicked (GtkMenuButton *menu, static void on_toggle_search_bar_activated (GSimpleAction *action,
GtkStack *stack); GVariant *param,
gpointer user_data);
static void on_view_menu_open_sub (GtkModelButton *button, static void on_view_menu_open_sub (GtkModelButton *button,
GtkStack *stack); GtkStack *stack);
static void on_view_menu_open_parent (GtkModelButton *button, static void on_view_menu_open_parent (GtkModelButton *button,
GtkStack *stack); GtkStack *stack);
static void on_weather_location_searchbox_change (GWeatherLocationEntry *entry, static void on_weather_location_searchbox_change (GWeatherLocationEntry *entry,
GcalWindow *self); GcalWindow *self);
static void on_show_weather_change (GtkSwitch *wswitch, static void on_show_weather_change (GtkSwitch *wswitch,
GParamSpec *pspec, GParamSpec *pspec,
GcalWindow *self); GcalWindow *self);
static void on_auto_location_change (GtkSwitch *lswitch, static void on_auto_location_change (GtkSwitch *lswitch,
GParamSpec *pspec, GParamSpec *pspec,
GcalWindow *self); GcalWindow *self);
static gboolean on_weather_location_searchbox_match_selected static gboolean on_weather_location_searchbox_match_selected (GtkEntryCompletion *sender,
(GtkEntryCompletion *sender, GtkTreeModel *model,
GtkTreeModel *model, GtkTreeIter *iter,
GtkTreeIter *iter, GcalWindow *self);
GcalWindow *self);
static void set_model_button_animation (GtkBuilder *builder, static void set_model_button_animation (GtkBuilder *builder,
GtkStack *stack, GtkStack *stack,
const char *id, const char *id,
gboolean go_back); gboolean go_back);
static void update_menu_weather_sensitivity (GcalWindow *self);
static void update_menu_weather_sensitivity (GcalWindow *self);
static void close_menu (GcalWindow *self); static void close_menu (GcalWindow *self);
static void safe_weather_settings (GcalWindow *self); static void safe_weather_settings (GcalWindow *self);
static void load_weather_settings (GcalWindow *self); static void load_weather_settings (GcalWindow *self);
static void manage_weather_service (GcalWindow *self); static void manage_weather_service (GcalWindow *self);
static GWeatherLocation* get_checked_fixed_location (GcalWindow *self); static GWeatherLocation* get_checked_fixed_location (GcalWindow *self);
G_DEFINE_TYPE (GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW) G_DEFINE_TYPE (GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
+23 -23
View File
@@ -48,57 +48,57 @@
*/ */
typedef struct typedef struct
{ {
GcalWeatherInfo *winfo; /* owned */ GcalWeatherInfo *winfo; /* owned */
GdkPixbuf *icon_buf; /* owned */ GdkPixbuf *icon_buf; /* owned */
} WeatherInfoDay; } WeatherInfoDay;
struct _GcalWeekHeader struct _GcalWeekHeader
{ {
GtkGrid parent; GtkGrid parent;
GtkWidget *grid; GtkWidget *grid;
GtkWidget *month_label; GtkWidget *month_label;
GtkWidget *week_label; GtkWidget *week_label;
GtkWidget *year_label; GtkWidget *year_label;
GtkWidget *scrolledwindow; GtkWidget *scrolledwindow;
GtkWidget *expand_button; GtkWidget *expand_button;
GtkWidget *expand_button_box; GtkWidget *expand_button_box;
GtkWidget *expand_button_image; GtkWidget *expand_button_image;
GtkWidget *header_labels_box; GtkWidget *header_labels_box;
GcalManager *manager; GcalManager *manager;
/* /*
* Stores the events as they come from the week-view * Stores the events as they come from the week-view
* The list will later be iterated after the active date is changed * The list will later be iterated after the active date is changed
* and the events will be placed * and the events will be placed
*/ */
GList *events[7]; GList *events[7];
GtkWidget *overflow_label[7]; GtkWidget *overflow_label[7];
gint first_weekday; gint first_weekday;
/* /*
* Used for checking if the header is in collapsed state or expand state * Used for checking if the header is in collapsed state or expand state
* false is collapse state true is expand state * false is collapse state true is expand state
*/ */
gboolean expanded; gboolean expanded;
gboolean use_24h_format; gboolean use_24h_format;
icaltimetype *active_date; icaltimetype *active_date;
gint selection_start; gint selection_start;
gint selection_end; gint selection_end;
gint dnd_cell; gint dnd_cell;
GcalWeatherService *weather_service; /* unowned, nullable */ GcalWeatherService *weather_service; /* unowned, nullable */
/* Array of nullable weather infos for each day, starting with Sunday. */ /* Array of nullable weather infos for each day, starting with Sunday. */
WeatherInfoDay weather_infos[7]; WeatherInfoDay weather_infos[7];
GtkSizeGroup *sizegroup; GtkSizeGroup *sizegroup;
}; };
typedef enum typedef enum
+12 -12
View File
@@ -43,39 +43,39 @@ static const double dashed [] =
struct _GcalWeekView struct _GcalWeekView
{ {
GtkBox parent; GtkBox parent;
GtkWidget *header; GtkWidget *header;
GtkWidget *hours_bar; GtkWidget *hours_bar;
GtkWidget *scrolled_window; GtkWidget *scrolled_window;
GtkWidget *week_grid; GtkWidget *week_grid;
/* /*
* first day of the week according to user locale, being * first day of the week according to user locale, being
* 0 for Sunday, 1 for Monday and so on * 0 for Sunday, 1 for Monday and so on
*/ */
gint first_weekday; gint first_weekday;
/* /*
* clock format from GNOME desktop settings * clock format from GNOME desktop settings
*/ */
gboolean use_24h_format; gboolean use_24h_format;
/* property */ /* property */
icaltimetype *date; icaltimetype *date;
GcalManager *manager; /* owned */ GcalManager *manager; /* owned */
GcalWeatherService *weather_service; /* owned */ GcalWeatherService *weather_service; /* owned */
guint scroll_grid_timeout_id; guint scroll_grid_timeout_id;
gint clicked_cell; gint clicked_cell;
}; };
static void schedule_position_scroll (GcalWeekView *self); static void schedule_position_scroll (GcalWeekView *self);
static void gcal_view_interface_init (GcalViewInterface *iface); static void gcal_view_interface_init (GcalViewInterface *iface);
static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface); static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface);
enum enum
{ {
+43 -42
View File
@@ -35,90 +35,90 @@
typedef struct typedef struct
{ {
/* month span from 0 to 11 */ /* month span from 0 to 11 */
gint start_day, start_month; gint start_day, start_month;
gint end_day, end_month; gint end_day, end_month;
gint hovered_day, hovered_month; gint hovered_day, hovered_month;
gint dnd_day, dnd_month; gint dnd_day, dnd_month;
} ButtonData; } ButtonData;
typedef struct typedef struct
{ {
gdouble box_side; gdouble box_side;
GdkPoint coordinates [12]; GdkPoint coordinates [12];
} GridData; } GridData;
struct _GcalYearView struct _GcalYearView
{ {
GtkBox parent; GtkBox parent;
/* composite, GtkBuilder's widgets */ /* composite, GtkBuilder's widgets */
GtkWidget *navigator; GtkWidget *navigator;
GtkWidget *sidebar; GtkWidget *sidebar;
GtkWidget *events_sidebar; GtkWidget *events_sidebar;
GtkWidget *navigator_stack; GtkWidget *navigator_stack;
GtkWidget *no_events_title; GtkWidget *no_events_title;
GtkWidget *navigator_sidebar; GtkWidget *navigator_sidebar;
GtkWidget *scrolled_window; GtkWidget *scrolled_window;
GtkLabel *temp_label; /* unowned */ GtkLabel *temp_label; /* unowned */
GtkImage *weather_icon; /* unowned */ GtkImage *weather_icon; /* unowned */
GtkWidget *popover; /* Popover for popover_mode */ GtkWidget *popover; /* Popover for popover_mode */
/* manager singleton */ /* manager singleton */
GcalManager *manager; GcalManager *manager;
GcalWeatherService *weather_service; /* owned, nullable */ GcalWeatherService *weather_service; /* owned, nullable */
/* range shown on the sidebar */ /* range shown on the sidebar */
icaltimetype *start_selected_date; icaltimetype *start_selected_date;
icaltimetype *end_selected_date; icaltimetype *end_selected_date;
/* geometry info */ /* geometry info */
GridData *navigator_grid; GridData *navigator_grid;
guint number_of_columns; guint number_of_columns;
guint column_width; guint column_width;
guint row_height; guint row_height;
guint header_height; guint header_height;
guint sidebar_width; guint sidebar_width;
/* state flags */ /* state flags */
gboolean popover_mode; gboolean popover_mode;
gboolean button_pressed; gboolean button_pressed;
ButtonData *selected_data; ButtonData *selected_data;
/** /**
* first day of the week according to user locale, being * first day of the week according to user locale, being
* 0 for Sunday, 1 for Monday and so on * 0 for Sunday, 1 for Monday and so on
*/ */
gint first_weekday; gint first_weekday;
/* first and last weeks of the year */ /* first and last weeks of the year */
guint first_week_of_year; guint first_week_of_year;
guint last_week_of_year; guint last_week_of_year;
/* Storage for the accumulated scrolling */ /* Storage for the accumulated scrolling */
gdouble scroll_value; gdouble scroll_value;
/** /**
* clock format from GNOME desktop settings * clock format from GNOME desktop settings
*/ */
gboolean use_24h_format; gboolean use_24h_format;
/* show week numbers from GNOME Shell settings */ /* show week numbers from GNOME Shell settings */
GSettings *calendar_settings; GSettings *calendar_settings;
gboolean show_week_numbers; gboolean show_week_numbers;
/* text direction factors */ /* text direction factors */
gint k; gint k;
/* date property */ /* date property */
icaltimetype *date; icaltimetype *date;
/* /*
* Array with the events at every month. Events * Array with the events at every month. Events
* that span multiple months are added multiple * that span multiple months are added multiple
* times to the array. * times to the array.
*/ */
GPtrArray *events[12]; GPtrArray *events[12];
}; };
enum { enum {
@@ -139,9 +139,10 @@ enum
static guint signals[NUM_SIGNALS] = { 0, }; static guint signals[NUM_SIGNALS] = { 0, };
static gpointer year_view_parent_class = NULL; static gpointer year_view_parent_class = NULL;
static void gcal_view_interface_init (GcalViewInterface *iface); static void gcal_view_interface_init (GcalViewInterface *iface);
static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface); static void gcal_data_model_subscriber_interface_init (ECalDataModelSubscriberInterface *iface);
static void update_weather (GcalYearView *self); static void update_weather (GcalYearView *self);
G_DEFINE_TYPE_WITH_CODE (GcalYearView, gcal_year_view, GTK_TYPE_BOX, G_DEFINE_TYPE_WITH_CODE (GcalYearView, gcal_year_view, GTK_TYPE_BOX,
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW, gcal_view_interface_init) G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW, gcal_view_interface_init)
+8 -6
View File
@@ -31,12 +31,14 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GcalYearView, gcal_year_view, GCAL, YEAR_VIEW, GtkBox) G_DECLARE_FINAL_TYPE (GcalYearView, gcal_year_view, GCAL, YEAR_VIEW, GtkBox)
void gcal_year_view_set_first_weekday (GcalYearView *year_view, void gcal_year_view_set_first_weekday (GcalYearView *year_view,
gint nr_day); gint nr_day);
void gcal_year_view_set_use_24h_format (GcalYearView *year_view,
gboolean use_24h_format); void gcal_year_view_set_use_24h_format (GcalYearView *year_view,
void gcal_year_view_set_current_date (GcalYearView *year_view, gboolean use_24h_format);
icaltimetype *current_date);
void gcal_year_view_set_current_date (GcalYearView *year_view,
icaltimetype *current_date);
G_END_DECLS G_END_DECLS