/* gcal-source-dialog.c * * Copyright (C) 2015 Georges Basile Stavracas Neto * * 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 . */ #include "gcal-source-dialog.h" typedef struct { gint mode : 1; /* manager */ GcalManager *manager; } GcalSourceDialogPrivate; struct _GcalSourceDialog { GtkDialog parent; /*< private >*/ GcalSourceDialogPrivate *priv; }; G_DEFINE_TYPE_WITH_PRIVATE (GcalSourceDialog, gcal_source_dialog, GTK_TYPE_DIALOG) enum { PROP_0, LAST_PROP }; static GParamSpec *gParamSpecs [LAST_PROP]; GcalSourceDialog * gcal_source_dialog_new (void) { return g_object_new (GCAL_TYPE_SOURCE_DIALOG, NULL); } static void gcal_source_dialog_finalize (GObject *object) { GcalSourceDialog *self = (GcalSourceDialog *)object; GcalSourceDialogPrivate *priv = gcal_source_dialog_get_instance_private (self); G_OBJECT_CLASS (gcal_source_dialog_parent_class)->finalize (object); } static void gcal_source_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GcalSourceDialog *self = GCAL_SOURCE_DIALOG (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } static void gcal_source_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GcalSourceDialog *self = GCAL_SOURCE_DIALOG (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } static void gcal_source_dialog_class_init (GcalSourceDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = gcal_source_dialog_finalize; object_class->get_property = gcal_source_dialog_get_property; object_class->set_property = gcal_source_dialog_set_property; /* bind things for/from the template class */ gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/source-dialog.ui"); } static void gcal_source_dialog_init (GcalSourceDialog *self) { GcalSourceDialogPrivate *priv = gcal_source_dialog_get_instance_private (self); self->priv = priv; gtk_widget_init_template (GTK_WIDGET (self)); } /** * gcal_source_dialog_set_manager: * * Setup the {@link GcalManager} singleton * instance of the application. * * Returns: */ void gcal_source_dialog_set_manager (GcalSourceDialog *dialog, GcalManager *manager) { GcalSourceDialogPrivate *priv = dialog->priv; priv->manager = manager; /* TODO: connect ::source-added & ::source-removed signals */ } /** * gcal_source_dialog_set_mode: * * Set the source dialog mode. Creation * mode means that a new calendar will * be created, while edit mode means a * calendar will be edited. * * Returns: */ gcal_source_dialog_set_mode (GcalSourceDialog *dialog, GcalSourceDialogMode mode) { GcalSourceDialogPrivate *priv = dialog->priv; priv->mode = mode; /* TODO: change UI */ }