kopia lustrzana https://gitlab.com/Zwarf/picplanner
finaly the overview page is now a new GObject subclass! 0 Errors 0 Warnings (Wuhuu)
rodzic
2cfbd2a068
commit
4b6159f2c8
|
@ -3,6 +3,7 @@ picplanner_sources = [
|
|||
'picplanner-window.c',
|
||||
'picplanner-application.c',
|
||||
'ui-defines/preferences-dialog.c',
|
||||
'ui-defines/overview-view.c',
|
||||
'calculations/calculations_transformations.c',
|
||||
'calculations/calculations_sun.c',
|
||||
'calculations/calculations_moon.c',
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "picplanner-application.h"
|
||||
#include "picplanner-window.h"
|
||||
#include "ui-defines/preferences-dialog.h"
|
||||
#include "ui-defines/overview-view.h"
|
||||
|
||||
struct _PicplannerApplication
|
||||
{
|
||||
|
@ -117,6 +118,7 @@ picplanner_application_show_about (GSimpleAction *action,
|
|||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
picplanner_application_show_preferences (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
|
@ -149,6 +151,7 @@ picplanner_application_init (PicplannerApplication *self)
|
|||
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (preferences_action));
|
||||
|
||||
|
||||
|
||||
const char *accels[] = {"<primary>q", NULL};
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", accels);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "picplanner-config.h"
|
||||
#include "picplanner-window.h"
|
||||
#include "ui-defines/overview-view.h"
|
||||
|
||||
|
||||
struct _PicplannerWindow
|
||||
{
|
||||
|
@ -25,10 +26,27 @@ struct _PicplannerWindow
|
|||
|
||||
/* Template widgets */
|
||||
GtkHeaderBar *header_bar;
|
||||
GtkWidget *overview_page;
|
||||
GtkWidget *sun_page;
|
||||
GtkWidget *moon_page;
|
||||
GtkWidget *milky_way_page;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PicplannerWindow, picplanner_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
|
||||
static void
|
||||
overview_realize (GtkWidget *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
(void) self;
|
||||
(void) user_data;
|
||||
g_print ("overview is being realized");
|
||||
PicplannerOverview *overview = picplanner_overview_new ();
|
||||
gtk_box_append (GTK_BOX(self), GTK_WIDGET(overview));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
picplanner_window_class_init (PicplannerWindowClass *klass)
|
||||
{
|
||||
|
@ -36,6 +54,12 @@ picplanner_window_class_init (PicplannerWindowClass *klass)
|
|||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/de/zwarf/picplanner/picplanner-window.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, header_bar);
|
||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, overview_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, sun_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, moon_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, PicplannerWindow, milky_way_page);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, overview_realize);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "picplanner-config.h"
|
||||
#include "picplanner-application.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
@ -46,18 +46,19 @@
|
|||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<child>
|
||||
<object class="GtkStackPage" id="overview-page">
|
||||
<object class="GtkStackPage" id="overview_page">
|
||||
<property name="name">page1</property>
|
||||
<property name="title">Overview</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Overview</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<signal name="realize" handler="overview_realize"/>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage" id="sun-page">
|
||||
<object class="GtkStackPage" id="sun_page">
|
||||
<property name="name">page2</property>
|
||||
<property name="title">Sun</property>
|
||||
<property name="child">
|
||||
|
@ -68,7 +69,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage" id="moon-page">
|
||||
<object class="GtkStackPage" id="moon_page">
|
||||
<property name="name">page3</property>
|
||||
<property name="title">Moon</property>
|
||||
<property name="child">
|
||||
|
@ -79,7 +80,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage" id="milky-way-page">
|
||||
<object class="GtkStackPage" id="milky_way_page">
|
||||
<property name="name">page4</property>
|
||||
<property name="title">Milky Way</property>
|
||||
<property name="child">
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
<gresource prefix="/de/zwarf/picplanner">
|
||||
<file>picplanner-window.ui</file>
|
||||
<file>ui/preferences-dialog.ui</file>
|
||||
<file>ui/overview-view.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#include "overview-view.h"
|
||||
|
||||
|
||||
struct _PicplannerOverview
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
GtkWidget parent;
|
||||
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (PicplannerOverview, picplanner_overview, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
picplanner_overview_init (PicplannerOverview *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
picplanner_overview_class_init (PicplannerOverviewClass *class)
|
||||
{
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/de/zwarf/picplanner/ui/overview-view.ui");
|
||||
}
|
||||
|
||||
PicplannerOverview *
|
||||
picplanner_overview_new ()
|
||||
{
|
||||
return g_object_new (PICPLANNER_OVERVIEW_TYPE, NULL);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include "picplanner-window.h"
|
||||
#include "picplanner-application.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PICPLANNER_OVERVIEW_TYPE (picplanner_overview_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (PicplannerOverview, picplanner_overview, PICPLANNER, OVERVIEW, GtkBox)
|
||||
|
||||
|
||||
PicplannerOverview *picplanner_overview_new ();
|
||||
|
||||
G_END_DECLS
|
|
@ -1,6 +1,5 @@
|
|||
#include "preferences-dialog.h"
|
||||
#include "picplanner-application.h"
|
||||
#include "picplanner-window.h"
|
||||
|
||||
|
||||
struct _PicplannerPrefs
|
||||
{
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __PICPLANNERAPPPREFS_H
|
||||
#define __PICPLANNERAPPPREFS_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "picplanner-window.h"
|
||||
#include "picplanner-application.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PICPLANNER_PREFS_TYPE (picplanner_prefs_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (PicplannerPrefs, picplanner_prefs, PICPLANNER, PREFS, GtkDialog)
|
||||
|
@ -28,6 +27,4 @@ G_DECLARE_FINAL_TYPE (PicplannerPrefs, picplanner_prefs, PICPLANNER, PREFS, GtkD
|
|||
|
||||
PicplannerPrefs *picplanner_prefs_new (PicplannerWindow *win);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="OverviewBox" parent="GtkBox">
|
||||
<template class="PicplannerOverview" parent="GtkBox">
|
||||
<property name="visible">true</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
|
|
Ładowanie…
Reference in New Issue