views/view: Add private signal helpers

They'll be useful to stop hijacking view signals.
This commit is contained in:
Georges Basile Stavracas Neto
2023-03-02 21:49:27 -03:00
parent 5a028471e9
commit 5d5709122f
2 changed files with 76 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
/* gcal-view-private.h
*
* Copyright 2023 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 "gcal-view.h"
G_BEGIN_DECLS
void gcal_view_create_event (GcalView *self,
GDateTime *start,
GDateTime *end,
gdouble x,
gdouble y);
void gcal_view_create_event_detailed (GcalView *self,
GDateTime *start,
GDateTime *end);
void gcal_view_event_activated (GcalView *self,
GcalEventWidget *event_widget);
G_END_DECLS
+36 -1
View File
@@ -21,7 +21,7 @@
#include "gcal-debug.h"
#include "gcal-event-widget.h"
#include "gcal-view.h"
#include "gcal-view-private.h"
#include "gcal-utils.h"
#include <glib.h>
@@ -264,3 +264,38 @@ gcal_view_get_previous_date (GcalView *self)
return g_steal_pointer (&previous_date);
}
void
gcal_view_create_event (GcalView *self,
GDateTime *start,
GDateTime *end,
gdouble x,
gdouble y)
{
g_assert (GCAL_IS_VIEW (self));
g_assert (start != NULL);
g_assert (end != NULL);
g_signal_emit (self, signals[CREATE_EVENT], 0, start, end, x, y);
}
void
gcal_view_create_event_detailed (GcalView *self,
GDateTime *start,
GDateTime *end)
{
g_assert (GCAL_IS_VIEW (self));
g_assert (start != NULL);
g_signal_emit (self, signals[CREATE_EVENT_DETAILED], 0, start, end);
}
void
gcal_view_event_activated (GcalView *self,
GcalEventWidget *event_widget)
{
g_assert (GCAL_IS_VIEW (self));
g_assert (GCAL_IS_EVENT_WIDGET (event_widget));
g_signal_emit (self, signals[EVENT_ACTIVATED], 0, event_widget);
}