new-calendar-page: Add stub page

parent 375b9fc5
......@@ -14,6 +14,7 @@
<file alias="month-popover.ui" compressed="true">ui/month-popover.ui</file>
<file alias="month-view.ui" compressed="true">ui/month-view.ui</file>
<file alias="multi-choice.ui" compressed="true">ui/multi-choice.ui</file>
<file alias="new-calendar-page.ui" compressed="true">ui/new-calendar-page.ui</file>
<file alias="online-account-row.ui" compressed="true">ui/online-account-row.ui</file>
<file alias="quick-add-popover.ui" compressed="true">ui/quick-add-popover.ui</file>
<file alias="search-popover.ui" compressed="true">ui/search-popover.ui</file>
......
......@@ -95,6 +95,7 @@ resource_data = files(
'ui/month-popover.ui',
'ui/month-view.ui',
'ui/multi-choice.ui',
'ui/new-calendar-page.ui',
'ui/quick-add-popover.ui',
'ui/search-popover.ui',
'ui/time-selector.ui',
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalNewCalendarPage" parent="GtkBox">
<property name="visible">True</property>
</template>
</interface>
......@@ -23,6 +23,7 @@
#include "gcal-calendar-management-dialog.h"
#include "gcal-calendar-management-page.h"
#include "gcal-calendars-page.h"
#include "gcal-new-calendar-page.h"
#include "gcal-utils.h"
#include <glib/gi18n.h>
......@@ -46,6 +47,7 @@
typedef enum
{
GCAL_PAGE_CALENDARS,
GCAL_PAGE_NEW_CALENDAR,
N_PAGES,
} GcalPageType;
......@@ -1390,6 +1392,7 @@ setup_context (GcalCalendarManagementDialog *self)
GType gtype;
} pages[] = {
{ GCAL_PAGE_CALENDARS, GCAL_TYPE_CALENDARS_PAGE },
{ GCAL_PAGE_NEW_CALENDAR, GCAL_TYPE_NEW_CALENDAR_PAGE },
};
gint i;
......
/* gcal-new-calendar-page.c
*
* Copyright 2019 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "GcalNewCalendarPage"
#include <glib/gi18n.h>
#include "gcal-context.h"
#include "gcal-calendar-management-page.h"
#include "gcal-new-calendar-page.h"
struct _GcalNewCalendarPage
{
GtkBox parent;
GcalContext *context;
};
static void gcal_calendar_management_page_iface_init (GcalCalendarManagementPageInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GcalNewCalendarPage, gcal_new_calendar_page, GTK_TYPE_BOX,
G_IMPLEMENT_INTERFACE (GCAL_TYPE_CALENDAR_MANAGEMENT_PAGE,
gcal_calendar_management_page_iface_init))
enum
{
PROP_0,
PROP_CONTEXT,
N_PROPS
};
/*
* GcalCalendarManagementPage iface
*/
static const gchar*
gcal_new_calendar_page_get_name (GcalCalendarManagementPage *page)
{
return "new-calendar";
}
static const gchar*
gcal_new_calendar_page_get_title (GcalCalendarManagementPage *page)
{
return _("New Calendar");
}
static void
gcal_calendar_management_page_iface_init (GcalCalendarManagementPageInterface *iface)
{
iface->get_name = gcal_new_calendar_page_get_name;
iface->get_title = gcal_new_calendar_page_get_title;
}
/*
* GObject overrides
*/
static void
gcal_new_calendar_page_finalize (GObject *object)
{
GcalNewCalendarPage *self = (GcalNewCalendarPage *)object;
g_clear_object (&self->context);
G_OBJECT_CLASS (gcal_new_calendar_page_parent_class)->finalize (object);
}
static void
gcal_new_calendar_page_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GcalNewCalendarPage *self = GCAL_NEW_CALENDAR_PAGE (object);
switch (prop_id)
{
case PROP_CONTEXT:
g_value_set_object (value, self->context);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
gcal_new_calendar_page_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GcalNewCalendarPage *self = GCAL_NEW_CALENDAR_PAGE (object);
switch (prop_id)
{
case PROP_CONTEXT:
self->context = g_value_dup_object (value);
g_assert (self->context != NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
gcal_new_calendar_page_class_init (GcalNewCalendarPageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gcal_new_calendar_page_finalize;
object_class->get_property = gcal_new_calendar_page_get_property;
object_class->set_property = gcal_new_calendar_page_set_property;
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/new-calendar-page.ui");
}
static void
gcal_new_calendar_page_init (GcalNewCalendarPage *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
/* gcal-new-calendar-page.h
*
* Copyright 2019 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GCAL_TYPE_NEW_CALENDAR_PAGE (gcal_new_calendar_page_get_type())
G_DECLARE_FINAL_TYPE (GcalNewCalendarPage, gcal_new_calendar_page, GCAL, NEW_CALENDAR_PAGE, GtkBox)
G_END_DECLS
......@@ -105,6 +105,7 @@ sources = files(
'gui/calendar-management/gcal-calendar-management-dialog.c',
'gui/calendar-management/gcal-calendar-management-page.c',
'gui/calendar-management/gcal-calendars-page.c',
'gui/calendar-management/gcal-new-calendar-page.c',
'gui/gcal-application.c',
'gui/gcal-calendar-popover.c',
'gui/gcal-date-chooser.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment