event-editor: Turn into an AdwDialog

This commit is contained in:
Georges Basile Stavracas Neto
2024-01-27 12:38:35 -03:00
parent 72d3caaf94
commit b52b27eace
5 changed files with 10 additions and 25 deletions
@@ -48,7 +48,7 @@
struct _GcalEventEditorDialog
{
AdwWindow parent;
AdwDialog parent;
GtkWidget *cancel_button;
GtkWidget *delete_button;
@@ -85,7 +85,7 @@ struct _GcalEventEditorDialog
gboolean writable;
};
G_DEFINE_TYPE (GcalEventEditorDialog, gcal_event_editor_dialog, ADW_TYPE_WINDOW)
G_DEFINE_TYPE (GcalEventEditorDialog, gcal_event_editor_dialog, ADW_TYPE_DIALOG)
enum
{
@@ -542,7 +542,7 @@ gcal_event_editor_dialog_finalize (GObject *object)
}
static void
gcal_event_editor_dialog_constructed (GObject* object)
gcal_event_editor_dialog_constructed (GObject *object)
{
const GActionEntry action_entries[] =
{
@@ -556,7 +556,7 @@ gcal_event_editor_dialog_constructed (GObject* object)
/* chaining up */
G_OBJECT_CLASS (gcal_event_editor_dialog_parent_class)->constructed (object);
gtk_window_set_title (GTK_WINDOW (object), "");
adw_dialog_set_title (ADW_DIALOG (object), "");
/* Actions */
self->action_group = g_simple_action_group_new ();
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
#define GCAL_TYPE_EVENT_EDITOR_DIALOG (gcal_event_editor_dialog_get_type ())
G_DECLARE_FINAL_TYPE (GcalEventEditorDialog, gcal_event_editor_dialog, GCAL, EVENT_EDITOR_DIALOG, AdwWindow);
G_DECLARE_FINAL_TYPE (GcalEventEditorDialog, gcal_event_editor_dialog, GCAL, EVENT_EDITOR_DIALOG, AdwDialog);
GtkWidget* gcal_event_editor_dialog_new (void);
@@ -1,21 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalEventEditorDialog" parent="AdwWindow">
<property name="modal">True</property>
<property name="default-width">700</property>
<property name="default-height">1000</property>
<property name="destroy-with-parent">True</property>
<property name="hide-on-close">True</property>
<child>
<object class="GtkShortcutController">
<child>
<object class="GtkShortcut">
<property name="trigger">Escape</property>
<property name="action">action(window.close)</property>
</object>
</child>
</object>
</child>
<template class="GcalEventEditorDialog" parent="AdwDialog">
<property name="content-width">700</property>
<property name="content-height">1000</property>
<child>
<object class="AdwToolbarView">
+2 -2
View File
@@ -646,7 +646,7 @@ create_event_detailed_cb (GcalView *view,
event = gcal_event_new (default_calendar, comp, NULL);
gcal_event_editor_dialog_set_event (self->event_editor, event, TRUE);
gtk_widget_set_visible (GTK_WIDGET (self->event_editor), TRUE);
adw_dialog_present (ADW_DIALOG (self->event_editor), GTK_WIDGET (self));
g_clear_object (&comp);
}
@@ -664,7 +664,7 @@ event_preview_cb (GcalEventWidget *event_widget,
case GCAL_EVENT_PREVIEW_ACTION_EDIT:
event = gcal_event_widget_get_event (event_widget);
gcal_event_editor_dialog_set_event (self->event_editor, event, FALSE);
gtk_window_present (GTK_WINDOW (self->event_editor));
adw_dialog_present (ADW_DIALOG (self->event_editor), GTK_WIDGET (self));
break;
case GCAL_EVENT_PREVIEW_ACTION_NONE:
-2
View File
@@ -312,8 +312,6 @@
<object class="GcalCalendarManagementDialog" id="calendar_management_dialog" />
<object class="GcalEventEditorDialog" id="event_editor">
<property name="visible">False</property>
<property name="transient_for">GcalWindow</property>
<signal name="remove-event" handler="on_event_editor_dialog_remove_event_cb" object="GcalWindow" swapped="no"/>
</object>