summaryrefslogtreecommitdiff
path: root/applets/clock/clock-location.h
diff options
context:
space:
mode:
Diffstat (limited to 'applets/clock/clock-location.h')
-rw-r--r--applets/clock/clock-location.h117
1 files changed, 43 insertions, 74 deletions
diff --git a/applets/clock/clock-location.h b/applets/clock/clock-location.h
index c12072ff..04a506ec 100644
--- a/applets/clock/clock-location.h
+++ b/applets/clock/clock-location.h
@@ -4,83 +4,52 @@
#include <time.h>
#include <glib.h>
#include <glib-object.h>
-#include <libmateweather/weather.h>
+#include <libgweather/gweather.h>
+#include "clock-utils.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
-#define CLOCK_LOCATION_TYPE (clock_location_get_type ())
-#define CLOCK_LOCATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLOCK_LOCATION_TYPE, ClockLocation))
-#define CLOCK_LOCATION_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), CLOCK_LOCATION_TYPE, ClockLocationClass))
-#define IS_CLOCK_LOCATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLOCK_LOCATION_TYPE))
-#define IS_CLOCK_LOCATION_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), CLOCK_LOCATION_TYPE))
-#define CLOCK_LOCATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLOCK_LOCATION_TYPE, ClockLocationClass))
+#define CLOCK_TYPE_LOCATION (clock_location_get_type ())
+G_DECLARE_DERIVABLE_TYPE (ClockLocation, clock_location, CLOCK, LOCATION, GObject)
-typedef struct
+struct _ClockLocationClass
{
- GObject g_object;
-} ClockLocation;
+ GObjectClass parent_class;
+ void (* weather_updated) (ClockLocation *location, GWeatherInfo *info);
+ void (* set_current) (ClockLocation *location);
+};
+
+GList* clock_locations_append (GList *locations, ClockLocation *loc);
+GList* clock_locations_merge (GList *old, GList *new);
+gboolean clock_locations_has_location (GList *locations, ClockLocation *loc);
+
+ClockLocation* clock_location_new (GWeatherLocation *gloc);
+GVariant* clock_location_serialize (ClockLocation *loc);
+ClockLocation* clock_location_deserialize (GVariant *serialized);
+gboolean clock_location_equal (ClockLocation *one, ClockLocation *two);
+
+const gchar* clock_location_get_tzname (ClockLocation *loc);
+const gchar* clock_location_get_tzid (ClockLocation *loc);
+
+const gchar* clock_location_get_display_name (ClockLocation *loc);
+const gchar* clock_location_get_name (ClockLocation *loc);
+const gchar* clock_location_get_sort_name (ClockLocation *loc);
+const gchar* clock_location_get_city (ClockLocation *loc);
+void clock_location_set_timezone (ClockLocation *loc, const gchar *timezone);
+void clock_location_get_coords (ClockLocation *loc, gfloat *latitude, gfloat *longitude);
+void clock_location_localtime (ClockLocation *loc, struct tm *tm);
+gboolean clock_location_is_current (ClockLocation *loc);
+void clock_location_make_current (ClockLocation *loc,
+ GFunc callback,
+ gpointer data,
+ GDestroyNotify destroy);
+gboolean clock_location_is_current_timezone (ClockLocation *loc);
+const gchar* clock_location_get_weather_code (ClockLocation *loc);
+GWeatherInfo* clock_location_get_weather_info (ClockLocation *loc);
+void clock_location_update_weather (ClockLocation *loc);
+GWeatherLocation* clock_location_get_glocation (ClockLocation *loc);
+gint clock_location_get_offset (ClockLocation *loc);
+
+G_END_DECLS
-typedef struct
-{
- GObjectClass g_object_class;
-
- void (* weather_updated) (ClockLocation *location, WeatherInfo *info);
-
- void (* set_current) (ClockLocation *location);
-} ClockLocationClass;
-
-GType clock_location_get_type (void);
-
-ClockLocation *clock_location_new (const gchar *name, const gchar *city,
- const gchar *timezone,
- gfloat latitude, gfloat longitude,
- const gchar *code,
- WeatherPrefs *prefs);
-
-ClockLocation *clock_location_find_and_ref (GList *locations,
- const gchar *name,
- const gchar *city,
- const gchar *timezone,
- gfloat latitude,
- gfloat longitude,
- const gchar *code);
-
-gchar *clock_location_get_tzname (ClockLocation *loc);
-
-const gchar *clock_location_get_display_name (ClockLocation *loc);
-
-const gchar *clock_location_get_name (ClockLocation *loc);
-void clock_location_set_name (ClockLocation *loc, const gchar *name);
-
-const gchar *clock_location_get_city (ClockLocation *loc);
-void clock_location_set_city (ClockLocation *loc, const gchar *city);
-
-gchar *clock_location_get_timezone (ClockLocation *loc);
-void clock_location_set_timezone (ClockLocation *loc, const gchar *timezone);
-
-void clock_location_get_coords (ClockLocation *loc, gfloat *latitude, gfloat *longitude);
-void clock_location_set_coords (ClockLocation *loc, gfloat latitude, gfloat longitude);
-
-void clock_location_localtime (ClockLocation *loc, struct tm *tm);
-
-gboolean clock_location_is_current (ClockLocation *loc);
-void clock_location_make_current (ClockLocation *loc,
- GFunc callback,
- gpointer data,
- GDestroyNotify destroy);
-gboolean clock_location_is_current_timezone (ClockLocation *loc);
-
-const gchar *clock_location_get_weather_code (ClockLocation *loc);
-void clock_location_set_weather_code (ClockLocation *loc, const gchar *code);
-WeatherInfo *clock_location_get_weather_info (ClockLocation *loc);
-void clock_location_set_weather_prefs (ClockLocation *loc,
- WeatherPrefs *weather_prefs);
-
-glong clock_location_get_offset (ClockLocation *loc);
-
-#ifdef __cplusplus
-}
-#endif
#endif /* __CLOCK_LOCATION_H__ */