kopia lustrzana https://gitlab.com/Zwarf/picplanner
Implement libadwaita and test online serach. Will might be replaced with libgweather?
rodzic
3af562cbf1
commit
49d5ca1410
|
@ -4,16 +4,16 @@
|
||||||
double
|
double
|
||||||
*picplanner_get_coordinates_rotational_milky_way (void)
|
*picplanner_get_coordinates_rotational_milky_way (void)
|
||||||
{
|
{
|
||||||
double *coordinates = malloc (sizeof (double) * 2);
|
|
||||||
double right_ascension = 266.417;
|
double right_ascension = 266.417;
|
||||||
double declination = -29.008;
|
double declination = -29.008;
|
||||||
|
double *coordinates_rotational = malloc (sizeof (double) * 2);
|
||||||
/* Coordinates are nearly fixed compared to the non rotating coordinate system of the earth.
|
/* Coordinates are nearly fixed compared to the non rotating coordinate system of the earth.
|
||||||
* Values taken from Wikipedia? TODO*/
|
* Values taken from Wikipedia? TODO*/
|
||||||
|
|
||||||
coordinates[0] = right_ascension;
|
coordinates_rotational[0] = right_ascension;
|
||||||
coordinates[1] = declination;
|
coordinates_rotational[1] = declination;
|
||||||
|
|
||||||
return coordinates;
|
return coordinates_rotational;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ double
|
||||||
{
|
{
|
||||||
double siderial_time;
|
double siderial_time;
|
||||||
double *coordinates_milky_way;
|
double *coordinates_milky_way;
|
||||||
double *coordinates_horizontal_milky_way = malloc (sizeof (double) * 2 * 288);
|
double *coordinates_horizontal_milky_way = malloc (sizeof (double) * 2 * NUM_DATA_POINTS);
|
||||||
|
|
||||||
coordinates_milky_way = picplanner_get_coordinates_rotational_milky_way ();
|
coordinates_milky_way = picplanner_get_coordinates_rotational_milky_way ();
|
||||||
siderial_time = time_jd_to_sidereal_time (longitude, date_time);
|
siderial_time = time_jd_to_sidereal_time (longitude, date_time);
|
||||||
|
@ -32,6 +32,8 @@ double
|
||||||
latitude,
|
latitude,
|
||||||
siderial_time);
|
siderial_time);
|
||||||
|
|
||||||
|
g_free (coordinates_milky_way);
|
||||||
|
|
||||||
return coordinates_horizontal_milky_way;
|
return coordinates_horizontal_milky_way;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +58,8 @@ double
|
||||||
array_coordinates_milky_way[2*i+1] = coordinates_milky_way[1];
|
array_coordinates_milky_way[2*i+1] = coordinates_milky_way[1];
|
||||||
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
||||||
}
|
}
|
||||||
|
g_date_time_unref (iteration_time);
|
||||||
|
g_free (coordinates_milky_way);
|
||||||
|
|
||||||
return array_coordinates_milky_way;
|
return array_coordinates_milky_way;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,13 @@
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
*picplanner_get_coordinates_rotational_milky_way (void);
|
*picplanner_get_coordinates_rotational_milky_way ();
|
||||||
|
|
||||||
double
|
double
|
||||||
*picplanner_get_coordinates_milky_way (GDateTime *date_time,
|
*picplanner_get_coordinates_milky_way (GDateTime *date_time,
|
||||||
double longitude,
|
double longitude,
|
||||||
double latitude);
|
double latitude);
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
*picplanner_get_array_coordinates_milky_way (GDateTime *date_time,
|
*picplanner_get_array_coordinates_milky_way (GDateTime *date_time,
|
||||||
double longitude,
|
double longitude,
|
||||||
|
|
|
@ -62,6 +62,8 @@ double
|
||||||
latitude,
|
latitude,
|
||||||
siderial_time);
|
siderial_time);
|
||||||
|
|
||||||
|
g_free (coordinates_moon);
|
||||||
|
|
||||||
return coordinates_horizontal_moon;
|
return coordinates_horizontal_moon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,5 +89,8 @@ double
|
||||||
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_date_time_unref (iteration_time);
|
||||||
|
g_free (coordinates_moon);
|
||||||
|
|
||||||
return array_coordinates_moon;
|
return array_coordinates_moon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,13 @@ double
|
||||||
double *coordinates_sun;
|
double *coordinates_sun;
|
||||||
double *coordinates_horizontal_sun = malloc (sizeof (double) * 2 * 288);
|
double *coordinates_horizontal_sun = malloc (sizeof (double) * 2 * 288);
|
||||||
|
|
||||||
|
|
||||||
coordinates_sun = picplanner_get_coordinates_rotational_sun (date_time);
|
coordinates_sun = picplanner_get_coordinates_rotational_sun (date_time);
|
||||||
siderial_time = time_jd_to_sidereal_time (longitude, date_time);
|
siderial_time = time_jd_to_sidereal_time (longitude, date_time);
|
||||||
coordinates_horizontal_sun = picplanner_transform_rotational_to_horizontal (coordinates_sun,
|
coordinates_horizontal_sun = picplanner_transform_rotational_to_horizontal (coordinates_sun,
|
||||||
latitude,
|
latitude,
|
||||||
siderial_time);
|
siderial_time);
|
||||||
|
g_free (coordinates_sun);
|
||||||
|
|
||||||
return coordinates_horizontal_sun;
|
return coordinates_horizontal_sun;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,7 @@ double
|
||||||
double *coordinates_sun;
|
double *coordinates_sun;
|
||||||
double *array_coordinates_sun = malloc (sizeof (double) * 2 * NUM_DATA_POINTS);
|
double *array_coordinates_sun = malloc (sizeof (double) * 2 * NUM_DATA_POINTS);
|
||||||
|
|
||||||
|
|
||||||
iteration_time = g_date_time_add_hours (date_time, -12);
|
iteration_time = g_date_time_add_hours (date_time, -12);
|
||||||
|
|
||||||
for (int i=0; i<NUM_DATA_POINTS; i++)
|
for (int i=0; i<NUM_DATA_POINTS; i++)
|
||||||
|
@ -74,10 +77,15 @@ double
|
||||||
coordinates_sun = picplanner_get_coordinates_sun (iteration_time,
|
coordinates_sun = picplanner_get_coordinates_sun (iteration_time,
|
||||||
longitude,
|
longitude,
|
||||||
latitude);
|
latitude);
|
||||||
|
|
||||||
array_coordinates_sun[2*i] = coordinates_sun[0];
|
array_coordinates_sun[2*i] = coordinates_sun[0];
|
||||||
array_coordinates_sun[2*i+1] = coordinates_sun[1];
|
array_coordinates_sun[2*i+1] = coordinates_sun[1];
|
||||||
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
iteration_time = g_date_time_add_minutes (iteration_time, 24*60/NUM_DATA_POINTS);
|
||||||
|
|
||||||
|
g_free (coordinates_sun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_date_time_unref (iteration_time);
|
||||||
|
|
||||||
return array_coordinates_sun;
|
return array_coordinates_sun;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ calc_jd (GDateTime *date_time)
|
||||||
* --> combining all of this leads to the above formula.
|
* --> combining all of this leads to the above formula.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
g_date_time_unref (date_time_utc);
|
||||||
|
|
||||||
return time_jd;
|
return time_jd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +160,8 @@ double
|
||||||
double x, y;
|
double x, y;
|
||||||
double azimuth, elevation;
|
double azimuth, elevation;
|
||||||
double right_ascension, declination;
|
double right_ascension, declination;
|
||||||
double *coordinates_hor = malloc (sizeof (double) * 2);
|
double *coordinates_horizontal = malloc (sizeof (double) * 2);
|
||||||
|
|
||||||
|
|
||||||
latitude = calc_deg_to_rad (latitude);
|
latitude = calc_deg_to_rad (latitude);
|
||||||
time_sidereal = calc_deg_to_rad (time_sidereal);
|
time_sidereal = calc_deg_to_rad (time_sidereal);
|
||||||
|
@ -186,20 +189,22 @@ double
|
||||||
elevation = asin (sin (latitude) * sin (declination)
|
elevation = asin (sin (latitude) * sin (declination)
|
||||||
+ cos (latitude) * cos (declination) * cos (time_sidereal - right_ascension));
|
+ cos (latitude) * cos (declination) * cos (time_sidereal - right_ascension));
|
||||||
|
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
* explanation missing!!
|
* explanation missing!!
|
||||||
* */
|
* */
|
||||||
/* g_print("Latitude %f, RA %f, dec %f, time_sidereal %f, azimuth %f, elevation %f\n", latitude, right_ascension, declination, time_sidereal, azimuth, elevation); */
|
/* g_print("Latitude %f, RA %f, dec %f, time_sidereal %f, azimuth %f, elevation %f\n", latitude, right_ascension, declination, time_sidereal, azimuth, elevation); */
|
||||||
|
|
||||||
|
|
||||||
azimuth = calc_rad_to_deg (azimuth);
|
azimuth = calc_rad_to_deg (azimuth);
|
||||||
elevation = calc_rad_to_deg (elevation);
|
elevation = calc_rad_to_deg (elevation);
|
||||||
|
|
||||||
coordinates_hor [0] = azimuth;
|
coordinates_horizontal [0] = azimuth;
|
||||||
coordinates_hor [1] = elevation;
|
coordinates_horizontal [1] = elevation;
|
||||||
|
|
||||||
/*g_print("Azimuth: %f, Elevation: %f\n", azimuth, elevation);*/
|
/*g_print("Azimuth: %f, Elevation: %f\n", azimuth, elevation);*/
|
||||||
|
|
||||||
return coordinates_hor;
|
return coordinates_horizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,10 @@ picplanner_sources = [
|
||||||
|
|
||||||
picplanner_deps = [
|
picplanner_deps = [
|
||||||
dependency('gtk4'),
|
dependency('gtk4'),
|
||||||
|
dependency('libadwaita-1'),
|
||||||
dependency('shumate-1.0'),
|
dependency('shumate-1.0'),
|
||||||
|
dependency('libsoup-2.4'),
|
||||||
|
dependency('json-glib-1.0'),
|
||||||
meson.get_compiler('c').find_library('m', required: false),
|
meson.get_compiler('c').find_library('m', required: false),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct _PicplannerApplication
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (PicplannerApplication, picplanner_application, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (PicplannerApplication, picplanner_application, ADW_TYPE_APPLICATION)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -41,6 +41,8 @@ first_run_set_timezone (PicplannerApplication *application)
|
||||||
|
|
||||||
g_settings_set_int (application->settings, "time-zone", timezone/3600/1000/1000);
|
g_settings_set_int (application->settings, "time-zone", timezone/3600/1000/1000);
|
||||||
g_settings_set_boolean (application->settings, "first-run", false);
|
g_settings_set_boolean (application->settings, "first-run", false);
|
||||||
|
|
||||||
|
g_date_time_unref (date_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +80,7 @@ picplanner_application_activate (GApplication *app)
|
||||||
window = g_object_new (PICPLANNER_TYPE_WINDOW,
|
window = g_object_new (PICPLANNER_TYPE_WINDOW,
|
||||||
"application", app,
|
"application", app,
|
||||||
"default-width", 600,
|
"default-width", 600,
|
||||||
"default-height", 800,
|
"default-height", 850,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Ask the window manager/compositor to present the window. */
|
/* Ask the window manager/compositor to present the window. */
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <adwaita.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define PICPLANNER_TYPE_APPLICATION (picplanner_application_get_type())
|
#define PICPLANNER_TYPE_APPLICATION (picplanner_application_get_type())
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (PicplannerApplication, picplanner_application, PICPLANNER, APPLICATION, GtkApplication)
|
G_DECLARE_FINAL_TYPE (PicplannerApplication, picplanner_application, PICPLANNER, APPLICATION, AdwApplication)
|
||||||
|
|
||||||
PicplannerApplication *picplanner_application_new (gchar *application_id,
|
PicplannerApplication *picplanner_application_new (gchar *application_id,
|
||||||
GApplicationFlags flags);
|
GApplicationFlags flags);
|
||||||
|
|
|
@ -23,9 +23,9 @@ picplanner_milky_way_set_rise_upper_set (GDateTime *date_time,
|
||||||
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
|
|
||||||
(void) date_time_rise;
|
g_date_time_unref (date_time_rise);
|
||||||
(void) date_time_upper;
|
g_date_time_unref (date_time_upper);
|
||||||
(void) date_time_set;
|
g_date_time_unref (date_time_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ picplanner_moon_set_rise_upper_set (GDateTime *date_time,
|
||||||
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
|
|
||||||
(void) date_time_rise;
|
g_date_time_unref (date_time_rise);
|
||||||
(void) date_time_upper;
|
g_date_time_unref (date_time_upper);
|
||||||
(void) date_time_set;
|
g_date_time_unref (date_time_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,8 @@ change_date_time_position (PicplannerOverview *overview)
|
||||||
* Emit a signal that the user changed the input.
|
* Emit a signal that the user changed the input.
|
||||||
*/
|
*/
|
||||||
g_signal_emit (overview, signal_input_changed, 0, NULL);
|
g_signal_emit (overview, signal_input_changed, 0, NULL);
|
||||||
|
|
||||||
|
g_date_time_unref (date_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,6 +234,9 @@ day_selected (GtkCalendar *self, PicplannerOverview *overview)
|
||||||
*/
|
*/
|
||||||
popover = GTK_POPOVER(overview->calendar_popover);
|
popover = GTK_POPOVER(overview->calendar_popover);
|
||||||
gtk_popover_popdown (popover);
|
gtk_popover_popdown (popover);
|
||||||
|
|
||||||
|
g_free (button_text);
|
||||||
|
g_date_time_unref (date_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ struct _PicplannerWindow
|
||||||
|
|
||||||
/* Template widgets */
|
/* Template widgets */
|
||||||
GtkHeaderBar *header_bar;
|
GtkHeaderBar *header_bar;
|
||||||
|
GtkWidget *box_main;
|
||||||
|
GtkWidget *stack;
|
||||||
GtkWidget *search_bar; /* Search bar for the location */
|
GtkWidget *search_bar; /* Search bar for the location */
|
||||||
GtkWidget *search_entry; /* The search entry inside the search bar */
|
GtkWidget *search_entry; /* The search entry inside the search bar */
|
||||||
GtkWidget *search_button; /* The search button in the header bar so show the search bar */
|
GtkWidget *search_button; /* The search button in the header bar so show the search bar */
|
||||||
|
@ -47,14 +49,53 @@ struct _PicplannerWindow
|
||||||
guint search_timeout_id;
|
guint search_timeout_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (PicplannerWindow, picplanner_window, GTK_TYPE_APPLICATION_WINDOW)
|
G_DEFINE_TYPE (PicplannerWindow, picplanner_window, ADW_TYPE_APPLICATION_WINDOW)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
websearch (PicplannerWindow *window)
|
websearch (PicplannerWindow *window)
|
||||||
{
|
{
|
||||||
(void) window;
|
|
||||||
g_print("Searching...\n");
|
g_print("Searching...\n");
|
||||||
|
char uri_string[200];
|
||||||
|
const gchar *nominatim_url = "https://nominatim.openstreetmap.org/search?q=";
|
||||||
|
const gchar *search_location = gtk_editable_get_text (GTK_EDITABLE (window->search_entry));
|
||||||
|
const gchar *nominatim_settings = "&format=geojson";
|
||||||
|
sprintf (uri_string, "%s%s%s", nominatim_url, search_location, nominatim_settings);
|
||||||
|
GUri *uri = g_uri_parse (uri_string, G_URI_FLAGS_NONE, NULL);
|
||||||
|
g_print ("%s\n", g_uri_to_string (uri));
|
||||||
|
|
||||||
|
SoupSession *session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, "testagent",
|
||||||
|
NULL);
|
||||||
|
SoupMessage *msg = soup_message_new (SOUP_METHOD_GET,g_uri_to_string(uri));
|
||||||
|
soup_session_send_message (session, msg);
|
||||||
|
|
||||||
|
JsonParser *parser;
|
||||||
|
JsonNode *root;
|
||||||
|
JsonObject *features;
|
||||||
|
JsonArray *array;
|
||||||
|
|
||||||
|
parser = json_parser_new ();
|
||||||
|
json_parser_load_from_data (parser, msg->response_body->data, -1, NULL);
|
||||||
|
root = json_parser_get_root (parser);
|
||||||
|
features = json_node_get_object (root);
|
||||||
|
array = json_object_get_array_member (features, "features");
|
||||||
|
|
||||||
|
for (uint i = 0; i < json_array_get_length (array); i++)
|
||||||
|
{
|
||||||
|
JsonNode *node;
|
||||||
|
JsonObject *object;
|
||||||
|
JsonNode *node_properties;
|
||||||
|
JsonObject *object_properties;
|
||||||
|
const gchar *char_display_name;
|
||||||
|
|
||||||
|
node = json_array_get_element (array, i);
|
||||||
|
object = json_node_get_object (node);
|
||||||
|
node_properties = json_object_get_member (object, "properties");
|
||||||
|
object_properties = json_node_get_object (node_properties);
|
||||||
|
char_display_name = json_object_get_string_member (object_properties, "display_name");
|
||||||
|
g_print ("%s\n", char_display_name);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,6 +159,7 @@ input_changed (GtkWidget *self,
|
||||||
date_time = picplanner_overview_get_date_time (PICPLANNER_OVERVIEW (window->overview_box));
|
date_time = picplanner_overview_get_date_time (PICPLANNER_OVERVIEW (window->overview_box));
|
||||||
|
|
||||||
/* Sun */
|
/* Sun */
|
||||||
|
|
||||||
array_coordinates_sun = picplanner_get_array_coordinates_sun (date_time,
|
array_coordinates_sun = picplanner_get_array_coordinates_sun (date_time,
|
||||||
longitude,
|
longitude,
|
||||||
latitude);
|
latitude);
|
||||||
|
@ -132,7 +174,9 @@ input_changed (GtkWidget *self,
|
||||||
|
|
||||||
(void) dark_blue_golden_index;
|
(void) dark_blue_golden_index;
|
||||||
|
|
||||||
|
|
||||||
/* Moon */
|
/* Moon */
|
||||||
|
/*
|
||||||
array_coordinates_moon = picplanner_get_array_coordinates_moon (date_time,
|
array_coordinates_moon = picplanner_get_array_coordinates_moon (date_time,
|
||||||
longitude,
|
longitude,
|
||||||
latitude);
|
latitude);
|
||||||
|
@ -140,8 +184,9 @@ input_changed (GtkWidget *self,
|
||||||
picplanner_moon_set_rise_upper_set (date_time,
|
picplanner_moon_set_rise_upper_set (date_time,
|
||||||
array_coordinates_sun,
|
array_coordinates_sun,
|
||||||
rise_upper_set_index_moon);
|
rise_upper_set_index_moon);
|
||||||
|
*/
|
||||||
/* Milky Way */
|
/* Milky Way */
|
||||||
|
/*
|
||||||
array_coordinates_milky_way = picplanner_get_array_coordinates_milky_way (date_time,
|
array_coordinates_milky_way = picplanner_get_array_coordinates_milky_way (date_time,
|
||||||
longitude,
|
longitude,
|
||||||
latitude);
|
latitude);
|
||||||
|
@ -149,6 +194,14 @@ input_changed (GtkWidget *self,
|
||||||
picplanner_milky_way_set_rise_upper_set (date_time,
|
picplanner_milky_way_set_rise_upper_set (date_time,
|
||||||
array_coordinates_sun,
|
array_coordinates_sun,
|
||||||
rise_upper_set_index_milky_way);
|
rise_upper_set_index_milky_way);
|
||||||
|
*/
|
||||||
|
g_free (rise_upper_set_index_sun);
|
||||||
|
//g_free (rise_upper_set_index_moon);
|
||||||
|
//g_free (rise_upper_set_index_milky_way);
|
||||||
|
g_free (dark_blue_golden_index);
|
||||||
|
g_free (array_coordinates_sun);
|
||||||
|
//g_free (array_coordinates_moon);
|
||||||
|
//g_free (array_coordinates_milky_way);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,6 +216,8 @@ picplanner_window_class_init (PicplannerWindowClass *klass)
|
||||||
g_type_ensure (PICPLANNER_MILKYWAY_TYPE);
|
g_type_ensure (PICPLANNER_MILKYWAY_TYPE);
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/de/zwarf/picplanner/window/picplanner-window.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/de/zwarf/picplanner/window/picplanner-window.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, box_main);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, stack);
|
||||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, header_bar);
|
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, header_bar);
|
||||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, search_bar);
|
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, search_bar);
|
||||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, search_entry);
|
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, search_entry);
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <adwaita.h>
|
||||||
|
#include <libsoup/soup.h>
|
||||||
|
#include <json-glib/json-glib.h>
|
||||||
#include "picplanner-config.h"
|
#include "picplanner-config.h"
|
||||||
#include "picplanner-application.h"
|
#include "picplanner-application.h"
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
#define PICPLANNER_TYPE_WINDOW picplanner_window_get_type()
|
#define PICPLANNER_TYPE_WINDOW picplanner_window_get_type()
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (PicplannerWindow, picplanner_window, PICPLANNER, WINDOW, GtkApplicationWindow)
|
G_DECLARE_FINAL_TYPE (PicplannerWindow, picplanner_window, PICPLANNER, WINDOW, AdwApplicationWindow)
|
||||||
|
|
||||||
PicplannerWindow *picplanner_window_new (PicplannerApplication *app);
|
PicplannerWindow *picplanner_window_new (PicplannerApplication *app);
|
||||||
void picplanner_window_open (PicplannerWindow *win, GFile *file);
|
void picplanner_window_open (PicplannerWindow *win, GFile *file);
|
||||||
|
|
|
@ -17,105 +17,122 @@
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
<template class="PicplannerWindow" parent="GtkApplicationWindow">
|
<template class="PicplannerWindow" parent="AdwApplicationWindow">
|
||||||
<property name="default-width">600</property>
|
<property name="default-width">600</property>
|
||||||
<property name="default-height">300</property>
|
<property name="default-height">300</property>
|
||||||
<property name="title">PicPlanner</property>
|
<property name="content">
|
||||||
<child type="titlebar">
|
|
||||||
<object class="GtkHeaderBar" id="header_bar">
|
|
||||||
<child type="start">
|
|
||||||
<object class="GtkToggleButton" id="search_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="active">False</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="margin-start">6</property>
|
|
||||||
<style>
|
|
||||||
<class name="title-button"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
|
||||||
<object class="GtkImage">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="icon-size">1</property>
|
|
||||||
<property name="icon-name">edit-find-symbolic</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child type="end">
|
|
||||||
<object class="GtkMenuButton">
|
|
||||||
<property name="icon-name">open-menu-symbolic</property>
|
|
||||||
<property name="menu-model">primary_menu</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child type="title">
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkStackSwitcher">
|
|
||||||
<property name="visible">true</property>
|
|
||||||
<property name="stack">stack</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
|
||||||
|
<object class="AdwHeaderBar" id="header_bar">
|
||||||
|
<child type="start">
|
||||||
|
<object class="GtkToggleButton" id="search_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="margin-start">6</property>
|
||||||
|
<style>
|
||||||
|
<class name="title-button"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
<property name="icon-name">edit-find-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="end">
|
||||||
|
<object class="GtkMenuButton">
|
||||||
|
<property name="icon-name">open-menu-symbolic</property>
|
||||||
|
<property name="menu-model">primary_menu</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="title">
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="hexpand">true</property>
|
||||||
|
<property name="halign">fill</property>
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewSwitcher">
|
||||||
|
<property name="hexpand">true</property>
|
||||||
|
<property name="halign">fill</property>
|
||||||
|
<property name="visible">true</property>
|
||||||
|
<property name="stack">stack</property>
|
||||||
|
<property name="policy">wide</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchBar" id="search_bar">
|
<object class="GtkBox" id="box_main">
|
||||||
<property name="visible">true</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="can_focus">true</property>
|
|
||||||
<property name="search-mode-enabled">false</property>
|
|
||||||
<property name="show-close-button">true</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="search_entry">
|
<object class="GtkSearchBar" id="search_bar">
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<property name="can_focus">true</property>
|
<property name="can_focus">true</property>
|
||||||
<property name="placeholder-text">Search...</property>
|
<property name="search-mode-enabled">false</property>
|
||||||
<signal name="search-changed" handler="search_text_changed"/>
|
<property name="show-close-button">true</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSearchEntry" id="search_entry">
|
||||||
|
<property name="visible">true</property>
|
||||||
|
<property name="can_focus">true</property>
|
||||||
|
<property name="placeholder-text">Search...</property>
|
||||||
|
<signal name="search-changed" handler="search_text_changed"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewStack" id="stack">
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewStackPage" id="overview_page">
|
||||||
|
<property name="name">page1</property>
|
||||||
|
<property name="title">Overview</property>
|
||||||
|
<property name="child">overview_box</property>
|
||||||
|
<property name="icon-name">emoji-recent-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewStackPage" id="sun_page">
|
||||||
|
<property name="name">page2</property>
|
||||||
|
<property name="title">Sun</property>
|
||||||
|
<property name="child">sun_box</property>
|
||||||
|
<property name="icon-name">weather-clear-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewStackPage" id="moon_page">
|
||||||
|
<property name="name">page3</property>
|
||||||
|
<property name="title">Moon</property>
|
||||||
|
<property name="child">moon_box</property>
|
||||||
|
<property name="icon-name">weather-clear-night-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="AdwViewStackPage" id="milky_way_page">
|
||||||
|
<property name="name">page4</property>
|
||||||
|
<property name="title">Milky Way</property>
|
||||||
|
<property name="child">milky_way_box</property>
|
||||||
|
<property name="icon-name">starred-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkStack" id="stack">
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkStackPage" id="overview_page">
|
|
||||||
<property name="name">page1</property>
|
|
||||||
<property name="title">Overview</property>
|
|
||||||
<property name="child">overview_box</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkStackPage" id="sun_page">
|
|
||||||
<property name="name">page2</property>
|
|
||||||
<property name="title">Sun</property>
|
|
||||||
<property name="child">sun_box</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkStackPage" id="moon_page">
|
|
||||||
<property name="name">page3</property>
|
|
||||||
<property name="title">Moon</property>
|
|
||||||
<property name="child">moon_box</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkStackPage" id="milky_way_page">
|
|
||||||
<property name="name">page4</property>
|
|
||||||
<property name="title">Milky Way</property>
|
|
||||||
<property name="child">milky_way_box</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<menu id="primary_menu">
|
<menu id="primary_menu">
|
||||||
|
|
|
@ -23,9 +23,9 @@ picplanner_sun_set_rise_upper_set (GDateTime *date_time,
|
||||||
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
|
||||||
|
|
||||||
(void) date_time_rise;
|
g_date_time_unref (date_time_rise);
|
||||||
(void) date_time_upper;
|
g_date_time_unref (date_time_upper);
|
||||||
(void) date_time_set;
|
g_date_time_unref (date_time_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue