[gnome-calendar] new-calendar-page: Add stub page
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] new-calendar-page: Add stub page
- Date: Tue, 25 Jun 2019 00:34:00 +0000 (UTC)
commit db4613ae71a8eaf35829ea57b0e40584811efdfc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jun 2 15:40:47 2019 -0300
new-calendar-page: Add stub page
data/calendar.gresource.xml | 1 +
data/meson.build | 1 +
data/ui/new-calendar-page.ui | 6 +
.../gcal-calendar-management-dialog.c | 3 +
.../calendar-management/gcal-new-calendar-page.c | 144 +++++++++++++++++++++
.../calendar-management/gcal-new-calendar-page.h | 30 +++++
src/meson.build | 1 +
7 files changed, 186 insertions(+)
---
diff --git a/data/calendar.gresource.xml b/data/calendar.gresource.xml
index 74331d7e..d54a5126 100644
--- a/data/calendar.gresource.xml
+++ b/data/calendar.gresource.xml
@@ -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>
diff --git a/data/meson.build b/data/meson.build
index 5befb3e0..a9c9e618 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -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',
diff --git a/data/ui/new-calendar-page.ui b/data/ui/new-calendar-page.ui
new file mode 100644
index 00000000..b7cd5926
--- /dev/null
+++ b/data/ui/new-calendar-page.ui
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GcalNewCalendarPage" parent="GtkBox">
+ <property name="visible">True</property>
+ </template>
+</interface>
diff --git a/src/gui/calendar-management/gcal-calendar-management-dialog.c
b/src/gui/calendar-management/gcal-calendar-management-dialog.c
index 5dd37a2d..da3bfeca 100644
--- a/src/gui/calendar-management/gcal-calendar-management-dialog.c
+++ b/src/gui/calendar-management/gcal-calendar-management-dialog.c
@@ -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;
diff --git a/src/gui/calendar-management/gcal-new-calendar-page.c
b/src/gui/calendar-management/gcal-new-calendar-page.c
new file mode 100644
index 00000000..aab88eb1
--- /dev/null
+++ b/src/gui/calendar-management/gcal-new-calendar-page.c
@@ -0,0 +1,144 @@
+/* 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));
+}
diff --git a/src/gui/calendar-management/gcal-new-calendar-page.h
b/src/gui/calendar-management/gcal-new-calendar-page.h
new file mode 100644
index 00000000..68be55b5
--- /dev/null
+++ b/src/gui/calendar-management/gcal-new-calendar-page.h
@@ -0,0 +1,30 @@
+/* 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
diff --git a/src/meson.build b/src/meson.build
index cdb76228..67f4e8d6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -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',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]