@@ -31,7 +31,7 @@ PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
 | 
				
			|||||||
PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.8])
 | 
					PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.8])
 | 
				
			||||||
PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
 | 
					PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
 | 
				
			||||||
PKG_CHECK_MODULES([LIBXSLT], [libexslt])
 | 
					PKG_CHECK_MODULES([LIBXSLT], [libexslt])
 | 
				
			||||||
PKG_CHECK_MODULES([WEBKIT], [webkitgtk-3.0])
 | 
					PKG_CHECK_MODULES([WEBKIT], [webkit2gtk-3.0])
 | 
				
			||||||
PKG_CHECK_MODULES([SWE_GLIB], [swe-glib >= 2.0.0])
 | 
					PKG_CHECK_MODULES([SWE_GLIB], [swe-glib >= 2.0.0])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AC_CONFIG_FILES([
 | 
					AC_CONFIG_FILES([
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										37
									
								
								src/ag-app.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/ag-app.c
									
									
									
									
									
								
							@@ -1,4 +1,6 @@
 | 
				
			|||||||
#include <glib/gi18n.h>
 | 
					#include <glib/gi18n.h>
 | 
				
			||||||
 | 
					#include <webkit2/webkit2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ag-app.h"
 | 
					#include "ag-app.h"
 | 
				
			||||||
#include "ag-window.h"
 | 
					#include "ag-window.h"
 | 
				
			||||||
#include "ag-chart.h"
 | 
					#include "ag-chart.h"
 | 
				
			||||||
@@ -6,7 +8,11 @@
 | 
				
			|||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#include "astrognome.h"
 | 
					#include "astrognome.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
G_DEFINE_TYPE(AgApp, ag_app, GTK_TYPE_APPLICATION);
 | 
					typedef struct _AgAppPrivate {
 | 
				
			||||||
 | 
					    WebKitWebViewGroup *web_view_group;
 | 
				
			||||||
 | 
					} AgAppPrivate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					G_DEFINE_TYPE_WITH_PRIVATE(AgApp, ag_app, GTK_TYPE_APPLICATION);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GtkWindow *
 | 
					GtkWindow *
 | 
				
			||||||
ag_app_peek_first_window(AgApp *app)
 | 
					ag_app_peek_first_window(AgApp *app)
 | 
				
			||||||
@@ -46,8 +52,9 @@ static GtkWidget *
 | 
				
			|||||||
ag_app_create_window(AgApp *app)
 | 
					ag_app_create_window(AgApp *app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GtkWidget *window;
 | 
					    GtkWidget *window;
 | 
				
			||||||
 | 
					    AgAppPrivate *priv = ag_app_get_instance_private(app);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window = ag_window_new(app);
 | 
					    window = ag_window_new(app, priv->web_view_group);
 | 
				
			||||||
    gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window));
 | 
					    gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window));
 | 
				
			||||||
    gtk_widget_show_all(window);
 | 
					    gtk_widget_show_all(window);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -331,6 +338,32 @@ ag_app_new(void)
 | 
				
			|||||||
static void
 | 
					static void
 | 
				
			||||||
ag_app_init(AgApp *app)
 | 
					ag_app_init(AgApp *app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    AgAppPrivate *priv;
 | 
				
			||||||
 | 
					    GBytes       *css_data;
 | 
				
			||||||
 | 
					    const gchar  *css_source;
 | 
				
			||||||
 | 
					    gsize        css_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv = ag_app_get_instance_private(app);
 | 
				
			||||||
 | 
					    priv->web_view_group = webkit_web_view_group_new(NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    css_data = g_resources_lookup_data(
 | 
				
			||||||
 | 
					            "/eu/polonkai/gergely/Astrognome/ui/chart-default.css",
 | 
				
			||||||
 | 
					            G_RESOURCE_LOOKUP_FLAGS_NONE,
 | 
				
			||||||
 | 
					            NULL
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ((css_source = g_bytes_get_data(css_data, &css_length)) != NULL) {
 | 
				
			||||||
 | 
					          webkit_web_view_group_add_user_style_sheet(
 | 
				
			||||||
 | 
					                priv->web_view_group,
 | 
				
			||||||
 | 
					                css_source,
 | 
				
			||||||
 | 
					                NULL,
 | 
				
			||||||
 | 
					                NULL,
 | 
				
			||||||
 | 
					                NULL,
 | 
				
			||||||
 | 
					                WEBKIT_INJECTED_CONTENT_FRAMES_TOP_ONLY
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_bytes_unref(css_data);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
#include <glib/gi18n.h>
 | 
					#include <glib/gi18n.h>
 | 
				
			||||||
#include <libxml/parser.h>
 | 
					#include <libxml/parser.h>
 | 
				
			||||||
#include <libxml/tree.h>
 | 
					#include <libxml/tree.h>
 | 
				
			||||||
#include <webkit/webkit.h>
 | 
					#include <webkit2/webkit2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <swe-glib.h>
 | 
					#include <swe-glib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -30,6 +30,7 @@ struct _AgWindowPrivate {
 | 
				
			|||||||
    GtkWidget     *second;
 | 
					    GtkWidget     *second;
 | 
				
			||||||
    GtkWidget     *timezone;
 | 
					    GtkWidget     *timezone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GtkWidget     *tab_chart;
 | 
				
			||||||
    GtkWidget     *tab_edit;
 | 
					    GtkWidget     *tab_edit;
 | 
				
			||||||
    GtkWidget     *current_tab;
 | 
					    GtkWidget     *current_tab;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -512,9 +513,9 @@ ag_window_redraw_chart(AgWindow *window)
 | 
				
			|||||||
        gtk_dialog_run(GTK_DIALOG(dialog));
 | 
					        gtk_dialog_run(GTK_DIALOG(dialog));
 | 
				
			||||||
        gtk_widget_destroy(dialog);
 | 
					        gtk_widget_destroy(dialog);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        webkit_web_view_load_string(
 | 
					        webkit_web_view_load_html(
 | 
				
			||||||
                WEBKIT_WEB_VIEW(priv->chart_web_view),
 | 
					                WEBKIT_WEB_VIEW(priv->chart_web_view),
 | 
				
			||||||
                svg_content, "image/svg+xml", "UTF-8", "file://");
 | 
					                svg_content, NULL);
 | 
				
			||||||
        g_free(svg_content);
 | 
					        g_free(svg_content);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -695,19 +696,6 @@ ag_window_init(AgWindow *window)
 | 
				
			|||||||
    g_signal_connect(G_OBJECT(main_settings), "changed::planets-char", G_CALLBACK(ag_window_display_changed), window);
 | 
					    g_signal_connect(G_OBJECT(main_settings), "changed::planets-char", G_CALLBACK(ag_window_display_changed), window);
 | 
				
			||||||
    g_signal_connect(G_OBJECT(main_settings), "changed::aspects-char", G_CALLBACK(ag_window_display_changed), window);
 | 
					    g_signal_connect(G_OBJECT(main_settings), "changed::aspects-char", G_CALLBACK(ag_window_display_changed), window);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    webkit_web_view_load_string(
 | 
					 | 
				
			||||||
            WEBKIT_WEB_VIEW(priv->chart_web_view),
 | 
					 | 
				
			||||||
            "<html>" \
 | 
					 | 
				
			||||||
                "<head>" \
 | 
					 | 
				
			||||||
                    "<title>No Chart</title>" \
 | 
					 | 
				
			||||||
                "</head>" \
 | 
					 | 
				
			||||||
                "<body>" \
 | 
					 | 
				
			||||||
                    "<h1>No Chart</h1>" \
 | 
					 | 
				
			||||||
                    "<p>No chart is loaded. Create one on the edit view, or open one from the application menu!</p>" \
 | 
					 | 
				
			||||||
                "</body>" \
 | 
					 | 
				
			||||||
            "</html>",
 | 
					 | 
				
			||||||
            "text/html", "UTF-8", NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "edit");
 | 
					    gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "edit");
 | 
				
			||||||
    priv->current_tab = priv->tab_edit;
 | 
					    priv->current_tab = priv->tab_edit;
 | 
				
			||||||
    g_object_set(priv->year_adjust, "lower", (gdouble)G_MININT, "upper", (gdouble)G_MAXINT, NULL);
 | 
					    g_object_set(priv->year_adjust, "lower", (gdouble)G_MININT, "upper", (gdouble)G_MAXINT, NULL);
 | 
				
			||||||
@@ -758,9 +746,13 @@ ag_window_class_init(AgWindowClass *klass)
 | 
				
			|||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, west_long);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, west_long);
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, latitude);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, latitude);
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, longitude);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, longitude);
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, chart_web_view);
 | 
					 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, aspect_table);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, aspect_table);
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, year_adjust);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, year_adjust);
 | 
				
			||||||
 | 
					    gtk_widget_class_bind_template_child_private(
 | 
				
			||||||
 | 
					            widget_class,
 | 
				
			||||||
 | 
					            AgWindow,
 | 
				
			||||||
 | 
					            tab_chart
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, stack);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, stack);
 | 
				
			||||||
    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, note_buffer);
 | 
					    gtk_widget_class_bind_template_child_private(widget_class, AgWindow, note_buffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -783,11 +775,29 @@ ag_window_configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpoint
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GtkWidget *
 | 
					GtkWidget *
 | 
				
			||||||
ag_window_new(AgApp *app)
 | 
					ag_window_new(AgApp *app, WebKitWebViewGroup *web_view_group)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    AgWindow        *window = g_object_new(AG_TYPE_WINDOW, NULL);
 | 
					    AgWindow        *window = g_object_new(AG_TYPE_WINDOW, NULL);
 | 
				
			||||||
    AgWindowPrivate *priv   = ag_window_get_instance_private(window);
 | 
					    AgWindowPrivate *priv   = ag_window_get_instance_private(window);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv->chart_web_view = webkit_web_view_new_with_group(web_view_group);
 | 
				
			||||||
 | 
					    gtk_container_add(GTK_CONTAINER(priv->tab_chart), priv->chart_web_view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // TODO: translate this error message!
 | 
				
			||||||
 | 
					    webkit_web_view_load_html(
 | 
				
			||||||
 | 
					            WEBKIT_WEB_VIEW(priv->chart_web_view),
 | 
				
			||||||
 | 
					            "<html>" \
 | 
				
			||||||
 | 
					                "<head>" \
 | 
				
			||||||
 | 
					                    "<title>No Chart</title>" \
 | 
				
			||||||
 | 
					                "</head>" \
 | 
				
			||||||
 | 
					                "<body>" \
 | 
				
			||||||
 | 
					                    "<h1>No Chart</h1>" \
 | 
				
			||||||
 | 
					                    "<p>No chart is loaded. Create one on the " \
 | 
				
			||||||
 | 
					                    "edit view, or open one from the application menu!</p>" \
 | 
				
			||||||
 | 
					                "</body>" \
 | 
				
			||||||
 | 
					            "</html>",
 | 
				
			||||||
 | 
					            NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_window_set_application(GTK_WINDOW(window), GTK_APPLICATION(app));
 | 
					    gtk_window_set_application(GTK_WINDOW(window), GTK_APPLICATION(app));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_window_set_icon_name(GTK_WINDOW(window), "astrognome");
 | 
					    gtk_window_set_icon_name(GTK_WINDOW(window), "astrognome");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,8 @@
 | 
				
			|||||||
#define __AG_WINDOW_H__
 | 
					#define __AG_WINDOW_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					#include <webkit2/webkit2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ag-app.h"
 | 
					#include "ag-app.h"
 | 
				
			||||||
#include "ag-chart.h"
 | 
					#include "ag-chart.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -32,7 +34,7 @@ struct _AgWindowClass {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GType ag_window_get_type(void) G_GNUC_CONST;
 | 
					GType ag_window_get_type(void) G_GNUC_CONST;
 | 
				
			||||||
GtkWidget *ag_window_new(AgApp *app);
 | 
					GtkWidget *ag_window_new(AgApp *app, WebKitWebViewGroup *web_view_group);
 | 
				
			||||||
void ag_window_set_chart(AgWindow *window,
 | 
					void ag_window_set_chart(AgWindow *window,
 | 
				
			||||||
                         AgChart  *chart);
 | 
					                         AgChart  *chart);
 | 
				
			||||||
AgChart *ag_window_get_chart(AgWindow *window);
 | 
					AgChart *ag_window_get_chart(AgWindow *window);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@
 | 
				
			|||||||
    <file>ui/astrognome.ui</file>
 | 
					    <file>ui/astrognome.ui</file>
 | 
				
			||||||
    <file>ui/ag-window.ui</file>
 | 
					    <file>ui/ag-window.ui</file>
 | 
				
			||||||
    <file>ui/ag-preferences.ui</file>
 | 
					    <file>ui/ag-preferences.ui</file>
 | 
				
			||||||
 | 
					    <file>ui/chart-default.css</file>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <file>default-icons/planet-sun.svg</file>
 | 
					    <file>default-icons/planet-sun.svg</file>
 | 
				
			||||||
  </gresource>
 | 
					  </gresource>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -568,15 +568,9 @@
 | 
				
			|||||||
          </packing>
 | 
					          </packing>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
          <object class="GtkScrolledWindow" id="tab_chart">
 | 
					          <object class="GtkAlignment" id="tab_chart">
 | 
				
			||||||
            <property name="shadow_type">in</property>
 | 
					            <property name="visible">True</property>
 | 
				
			||||||
            <child>
 | 
					            <property name="can_focus">False</property>
 | 
				
			||||||
              <object class="WebkitWebView" id="chart_web_view">
 | 
					 | 
				
			||||||
                <property name="width_request">600</property>
 | 
					 | 
				
			||||||
                <property name="height_request">600</property>
 | 
					 | 
				
			||||||
                <signal name="context-menu" handler="ag_window_chart_context_cb" swapped="no"/>
 | 
					 | 
				
			||||||
              </object>
 | 
					 | 
				
			||||||
            </child>
 | 
					 | 
				
			||||||
          </object>
 | 
					          </object>
 | 
				
			||||||
          <packing>
 | 
					          <packing>
 | 
				
			||||||
            <property name="name">chart</property>
 | 
					            <property name="name">chart</property>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										72
									
								
								src/resources/ui/chart-default.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								src/resources/ui/chart-default.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					circle.thick {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke-width: 2.5;
 | 
				
			||||||
 | 
					    stroke: #0000cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					circle.thin {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke-width: 1;
 | 
				
			||||||
 | 
					    stroke: #0000cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.degree-thick {
 | 
				
			||||||
 | 
					    stroke-width: 2;
 | 
				
			||||||
 | 
					    stroke: #0000cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.degree-thin {
 | 
				
			||||||
 | 
					    stroke-width: 1;
 | 
				
			||||||
 | 
					    stroke: #0000cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.house-cusp {
 | 
				
			||||||
 | 
					    stroke-width: 1;
 | 
				
			||||||
 | 
					    stroke: #0000cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.sign {
 | 
				
			||||||
 | 
					    stroke-width: 2;
 | 
				
			||||||
 | 
					    stroke-linecap: butt;
 | 
				
			||||||
 | 
					    stroke-linejoin: bevel;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.sign-fire {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke: #cc2222;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.sign-earth {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke: #22cc22;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.sign-air {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke: #cccc22;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.sign-water {
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke: #2222cc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.axis {
 | 
				
			||||||
 | 
					    stroke-width: 3;
 | 
				
			||||||
 | 
					    stroke: #000000;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.axis-end {
 | 
				
			||||||
 | 
					    marker-end: url(#arrow_end);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					line.planet-marker {
 | 
				
			||||||
 | 
					    stroke-width: 1.5;
 | 
				
			||||||
 | 
					    stroke: #555555;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					path.planet-symbol {
 | 
				
			||||||
 | 
					    stroke-width: 2;
 | 
				
			||||||
 | 
					    fill: none;
 | 
				
			||||||
 | 
					    stroke: #000080;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user