[gnome-calendar/gbsneto/gtk4: 16/46] calendar-manager/edit-calendar-page: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gbsneto/gtk4: 16/46] calendar-manager/edit-calendar-page: Port to GTK4
- Date: Sat, 12 Feb 2022 16:25:50 +0000 (UTC)
commit 5ee03040c534a81f19bd75fa065537993627befd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 11 17:22:07 2022 -0300
calendar-manager/edit-calendar-page: Port to GTK4
.../calendar-management/gcal-edit-calendar-page.c | 14 +-
.../calendar-management/gcal-edit-calendar-page.ui | 157 ++++++++-------------
2 files changed, 64 insertions(+), 107 deletions(-)
---
diff --git a/src/gui/calendar-management/gcal-edit-calendar-page.c
b/src/gui/calendar-management/gcal-edit-calendar-page.c
index 8b60aea4..e563d846 100644
--- a/src/gui/calendar-management/gcal-edit-calendar-page.c
+++ b/src/gui/calendar-management/gcal-edit-calendar-page.c
@@ -35,9 +35,9 @@ struct _GcalEditCalendarPage
GtkWidget *account_dim_label;
GtkWidget *back_button;
GtkColorChooser *calendar_color_button;
- GtkToggleButton *calendar_visible_check;
+ GtkCheckButton *calendar_visible_check;
GtkWidget *calendar_url_button;
- GtkToggleButton *default_check;
+ GtkCheckButton *default_check;
GtkWidget *location_dim_label;
GtkEntry *name_entry;
GtkWidget *remove_button;
@@ -193,10 +193,10 @@ setup_calendar (GcalEditCalendarPage *self,
}
gtk_color_chooser_set_rgba (self->calendar_color_button, gcal_calendar_get_color (calendar));
- gtk_entry_set_text (self->name_entry, gcal_calendar_get_name (calendar));
- gtk_toggle_button_set_active (self->calendar_visible_check, gcal_calendar_get_visible (calendar));
+ gtk_editable_set_text (GTK_EDITABLE (self->name_entry), gcal_calendar_get_name (calendar));
+ gtk_check_button_set_active (self->calendar_visible_check, gcal_calendar_get_visible (calendar));
- gtk_toggle_button_set_active (self->default_check, source == default_source);
+ gtk_check_button_set_active (self->default_check, source == default_source);
gtk_widget_set_visible (GTK_WIDGET (self->default_check), !gcal_calendar_is_read_only (calendar));
gtk_widget_set_visible (self->remove_button, e_source_get_removable (source));
}
@@ -214,10 +214,10 @@ update_calendar (GcalEditCalendarPage *self)
manager = gcal_context_get_manager (self->context);
gtk_color_chooser_get_rgba (self->calendar_color_button, &color);
- gcal_calendar_set_name (self->calendar, gtk_entry_get_text (self->name_entry));
+ gcal_calendar_set_name (self->calendar, gtk_editable_get_text (GTK_EDITABLE (self->name_entry)));
gcal_calendar_set_color (self->calendar, &color);
- if (gtk_toggle_button_get_active (self->default_check))
+ if (gtk_check_button_get_active (self->default_check))
gcal_manager_set_default_calendar (manager, self->calendar);
GCAL_EXIT;
diff --git a/src/gui/calendar-management/gcal-edit-calendar-page.ui
b/src/gui/calendar-management/gcal-edit-calendar-page.ui
index 80c91540..ccb355ab 100644
--- a/src/gui/calendar-management/gcal-edit-calendar-page.ui
+++ b/src/gui/calendar-management/gcal-edit-calendar-page.ui
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalEditCalendarPage" parent="GtkBox">
- <property name="visible">True</property>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="border_width">18</property>
+ <property name="margin-top">18</property>
+ <property name="margin-bottom">18</property>
+ <property name="margin-start">18</property>
+ <property name="margin-end">18</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
@@ -17,23 +18,25 @@
<property name="visible" bind-source="account_box" bind-property="visible" bind-flags="default"
/>
<property name="label" translatable="yes">Account</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
<style>
<class name="dim-label" />
</style>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkBox" id="account_box">
- <property name="visible">True</property>
<property name="spacing">12</property>
+ <layout>
+ <property name="row">0</property>
+ <property name="column">1</property>
+ </layout>
<child>
<object class="GtkLabel" id="account_label">
- <property name="visible">True</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
@@ -41,20 +44,10 @@
<child>
<object class="GtkButton" id="settings_button">
<property name="label" translatable="yes">Settings</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
<signal name="clicked" handler="on_settings_button_clicked_cb" object="GcalEditCalendarPage"
swapped="no" />
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="top_attach">0</property>
- <property name="left_attach">1</property>
- </packing>
</child>
<!-- Location (URL, file path) -->
@@ -63,149 +56,121 @@
<property name="visible" bind-source="calendar_url_button" bind-property="visible"
bind-flags="default" />
<property name="label" translatable="yes">Location</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label" />
</style>
</object>
- <packing>
- <property name="top_attach">1</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLinkButton" id="calendar_url_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">none</property>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">1</property>
+ </layout>
+ <style>
+ <class name="flat" />
+ </style>
</object>
- <packing>
- <property name="top_attach">1</property>
- <property name="left_attach">1</property>
- </packing>
</child>
<!-- Calendar name -->
<child>
<object class="GtkLabel" id="calendar_dim_label">
- <property name="visible">True</property>
<property name="label" translatable="yes">Calendar name</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label" />
</style>
</object>
- <packing>
- <property name="top_attach">2</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top_attach">2</property>
- <property name="left_attach">1</property>
- </packing>
</child>
<!-- Color -->
<child>
<object class="GtkLabel" id="color_dim_label">
- <property name="visible">True</property>
<property name="label" translatable="yes">Color</property>
<property name="xalign">1</property>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label" />
</style>
</object>
- <packing>
- <property name="top_attach">3</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkColorButton" id="calendar_color_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="halign">start</property>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top_attach">3</property>
- <property name="left_attach">1</property>
- </packing>
</child>
<!-- Calendar visibility -->
<child>
<object class="GtkCheckButton" id="calendar_visible_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="draw_indicator">True</property>
- <child>
- <object class="GtkLabel" id="display_calendar_check_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Display calendar</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Display calendar</property>
+ <layout>
+ <property name="row">4</property>
+ <property name="column">0</property>
+ <property name="column-span">2</property>
+ </layout>
</object>
- <packing>
- <property name="top_attach">4</property>
- <property name="left_attach">0</property>
- <property name="width">2</property>
- </packing>
</child>
<!-- Default calendar -->
<child>
<object class="GtkCheckButton" id="default_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="draw_indicator">True</property>
- <child>
- <object class="GtkLabel" id="default_check_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Add new events to this calendar by
default</property>
- <property name="xalign">0</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Add new events to this calendar by default</property>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">0</property>
+ <property name="column-span">2</property>
+ </layout>
</object>
- <packing>
- <property name="top_attach">5</property>
- <property name="left_attach">0</property>
- <property name="width">2</property>
- </packing>
</child>
<!-- Remove button -->
<child>
<object class="GtkButton" id="remove_button">
<property name="label" translatable="yes">Remove Calendar</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="halign">end</property>
<property name="valign">end</property>
<property name="margin_top">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="on_remove_button_clicked_cb" object="GcalEditCalendarPage"
swapped="no" />
+ <layout>
+ <property name="row">6</property>
+ <property name="column">0</property>
+ <property name="column-span">2</property>
+ </layout>
<style>
<class name="destructive-action" />
</style>
</object>
- <packing>
- <property name="top_attach">6</property>
- <property name="left_attach">0</property>
- <property name="width">2</property>
- </packing>
</child>
</object>
@@ -214,15 +179,7 @@
<!-- Headerbar buttons -->
<object class="GtkButton" id="back_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="icon-name">go-previous-symbolic</property>
<signal name="clicked" handler="on_back_button_clicked_cb" object="GcalEditCalendarPage" swapped="no" />
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-previous-symbolic</property>
- </object>
- </child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]