[gnome-calendar] window: Inherit from HdyApplicationWindow
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] window: Inherit from HdyApplicationWindow
- Date: Wed, 16 Sep 2020 15:32:39 +0000 (UTC)
commit 402ad34f4296895c2b6e0133fe3f26e5bea2c005
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Sat Sep 5 02:42:08 2020 +0200
window: Inherit from HdyApplicationWindow
This commit makes the toplevel GcalWindow inherit from
HdyApplicationWindow instead of GtkApplicationWindow.
src/gui/gcal-window.c | 4 +-
src/gui/gcal-window.h | 4 +-
src/gui/gcal-window.ui | 411 +++++++++++++++++++++++++------------------------
3 files changed, 214 insertions(+), 205 deletions(-)
---
diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c
index fbbb6aa2..7f238810 100644
--- a/src/gui/gcal-window.c
+++ b/src/gui/gcal-window.c
@@ -88,7 +88,7 @@ typedef struct
struct _GcalWindow
{
- GtkApplicationWindow parent;
+ HdyApplicationWindow parent;
/* timeout ids */
guint notification_timeout;
@@ -179,7 +179,7 @@ enum
gtk_application_set_accels_for_action (GTK_APPLICATION (app), action, tmp);\
}
-G_DEFINE_TYPE (GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (GcalWindow, gcal_window, HDY_TYPE_APPLICATION_WINDOW)
static GParamSpec* properties[N_PROPS] = { NULL, };
diff --git a/src/gui/gcal-window.h b/src/gui/gcal-window.h
index d7c58b46..4264e4b2 100644
--- a/src/gui/gcal-window.h
+++ b/src/gui/gcal-window.h
@@ -23,14 +23,14 @@
#include "gcal-enums.h"
#include "gcal-utils.h"
-#include <gtk/gtk.h>
+#include <handy.h>
G_BEGIN_DECLS
#define GCAL_TYPE_WINDOW (gcal_window_get_type ())
-G_DECLARE_FINAL_TYPE (GcalWindow, gcal_window, GCAL, WINDOW, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (GcalWindow, gcal_window, GCAL, WINDOW, HdyApplicationWindow)
GtkWidget* gcal_window_new_with_date (GcalApplication *app,
GDateTime *date);
diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui
index fec29b05..daf1009b 100644
--- a/src/gui/gcal-window.ui
+++ b/src/gui/gcal-window.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.14"/>
- <template class="GcalWindow" parent="GtkApplicationWindow">
+ <template class="GcalWindow" parent="HdyApplicationWindow">
<property name="window_position">center</property>
<property name="default_width">800</property>
<property name="default_height">600</property>
@@ -12,265 +12,274 @@
<class name="org-gnome-Calendar"/>
</style>
<child>
- <object class="GtkOverlay" id="views_overlay">
+ <object class="GtkBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="main_box">
+ <object class="GtkOverlay" id="views_overlay">
<property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
<child>
- <object class="GtkStack" id="views_stack">
+ <object class="GtkBox" id="main_box">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="transition_duration">250</property>
- <property name="transition_type">crossfade</property>
- <signal name="notify::visible-child" handler="view_changed" object="GcalWindow"
swapped="no"/>
- <style>
- <class name="view"/>
- </style>
- <child>
- <object class="GcalWeekView" id="week_view">
- <property name="visible">True</property>
- <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
- <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
- <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
- </object>
- <packing>
- <property name="name">week</property>
- <property name="title" translatable="yes">Week</property>
- </packing>
- </child>
+ <property name="orientation">vertical</property>
<child>
- <object class="GcalMonthView" id="month_view">
+ <object class="GtkStack" id="views_stack">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
- <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
- <signal name="create-event-detailed" handler="create_event_detailed_cb"
object="GcalWindow" swapped="no"/>
- <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="name">month</property>
- <property name="title" translatable="yes">Month</property>
- </packing>
- </child>
- <child>
- <object class="GcalYearView" id="year_view">
- <property name="visible">True</property>
- <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
- <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
- <signal name="create-event-detailed" handler="create_event_detailed_cb"
object="GcalWindow" swapped="no"/>
- <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="name">year</property>
- <property name="title" translatable="yes">Year</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="overlay">
- <object class="GtkRevealer" id="notification">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">start</property>
- <property name="transition_duration">100</property>
- <signal name="notify::child-revealed" handler="remove_event" object="GcalWindow" swapped="no"/>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
- <property name="margin_top">2</property>
- <property name="margin_bottom">2</property>
- <property name="column_spacing">12</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="transition_duration">250</property>
+ <property name="transition_type">crossfade</property>
+ <signal name="notify::visible-child" handler="view_changed" object="GcalWindow"
swapped="no"/>
+ <style>
+ <class name="view"/>
+ </style>
<child>
- <object class="GtkLabel" id="notification_label">
+ <object class="GcalWeekView" id="week_view">
<property name="visible">True</property>
- <property name="use_markup">True</property>
+ <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
+ <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
+ <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="name">week</property>
+ <property name="title" translatable="yes">Week</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="notification_action_button">
- <property name="label">button</property>
+ <object class="GcalMonthView" id="month_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="no_show_all">True</property>
- <signal name="clicked" handler="undo_remove_action" object="GcalWindow"
swapped="no"/>
- <style>
- <class name="text-button"/>
- </style>
+ <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
+ <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
+ <signal name="create-event-detailed" handler="create_event_detailed_cb"
object="GcalWindow" swapped="no"/>
+ <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="position">1</property>
+ <property name="name">month</property>
+ <property name="title" translatable="yes">Month</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="notification_close_button">
+ <object class="GcalYearView" id="year_view">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">none</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="hide_notification" object="GcalWindow"
swapped="yes"/>
+ <property name="active-date" bind-source="GcalWindow" bind-property="active-date"
bind-flags="bidirectional"/>
+ <signal name="create-event" handler="show_new_event_widget" object="GcalWindow"
swapped="no"/>
+ <signal name="create-event-detailed" handler="create_event_detailed_cb"
object="GcalWindow" swapped="no"/>
+ <signal name="event-activated" handler="event_activated" object="GcalWindow"
swapped="no"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="name">year</property>
+ <property name="title" translatable="yes">Year</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="overlay">
+ <object class="GtkRevealer" id="notification">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <property name="transition_duration">100</property>
+ <signal name="notify::child-revealed" handler="remove_event" object="GcalWindow"
swapped="no"/>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="margin_start">12</property>
+ <property name="margin_end">12</property>
+ <property name="margin_top">2</property>
+ <property name="margin_bottom">2</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="notification_label">
+ <property name="visible">True</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="notification_action_button">
+ <property name="label">button</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <signal name="clicked" handler="undo_remove_action" object="GcalWindow"
swapped="no"/>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkImage">
+ <object class="GtkButton" id="notification_close_button">
<property name="visible">True</property>
- <property name="icon_name">window-close-symbolic</property>
- <property name="icon_size">2</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="hide_notification" object="GcalWindow"
swapped="yes"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">window-close-symbolic</property>
+ <property name="icon_size">2</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
- <style>
- <class name="image-button"/>
- </style>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
</child>
+ <style>
+ <class name="app-notification"/>
+ </style>
</object>
</child>
- <style>
- <class name="app-notification"/>
- </style>
</object>
</child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
- </object>
- </child>
- <child type="titlebar">
- <object class="GtkHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="show_close_button">True</property>
- <property name="title" translatable="yes">Calendar</property>
<child>
- <object class="GtkButton" id="new_event_button">
+ <object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="action-name">win.new-event</property>
- <property name="tooltip_text" translatable="yes" context="tooltip">Add a new event</property>
+ <property name="show_close_button">True</property>
+ <property name="title" translatable="yes">Calendar</property>
<child>
- <object class="GtkImage">
+ <object class="GtkButton" id="new_event_button">
<property name="visible">True</property>
- <property name="icon-name">list-add-symbolic</property>
+ <property name="can_focus">True</property>
+ <property name="action-name">win.new-event</property>
+ <property name="tooltip_text" translatable="yes" context="tooltip">Add a new event</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">list-add-symbolic</property>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="today_button">
- <property name="label" translatable="yes">Today</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="action-name">win.today</property>
- <accelerator key="t" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
- <accelerator key="Home" signal="clicked"/>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="button_box">
- <property name="visible">True</property>
<child>
- <object class="GtkButton" id="back_button">
+ <object class="GtkButton" id="today_button">
+ <property name="label" translatable="yes">Today</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="action-name">win.previous-date</property>
- <accelerator key="Left" modifiers="GDK_MOD1_MASK" signal="clicked"/>
- <accelerator key="Page_Up" signal="clicked"/>
+ <property name="action-name">win.today</property>
+ <accelerator key="t" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
+ <accelerator key="Home" signal="clicked"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="button_box">
+ <property name="visible">True</property>
<child>
- <object class="GtkImage" id="go_back_image">
+ <object class="GtkButton" id="back_button">
<property name="visible">True</property>
- <property name="icon_name">go-previous-symbolic</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action-name">win.previous-date</property>
+ <accelerator key="Left" modifiers="GDK_MOD1_MASK" signal="clicked"/>
+ <accelerator key="Page_Up" signal="clicked"/>
+ <child>
+ <object class="GtkImage" id="go_back_image">
+ <property name="visible">True</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ </object>
+ </child>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="forward_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action-name">win.next-date</property>
+ <accelerator key="Right" modifiers="GDK_MOD1_MASK" signal="clicked"/>
+ <accelerator key="Page_Down" signal="clicked"/>
+ <child>
+ <object class="GtkImage" id="go_next_image">
+ <property name="visible">True</property>
+ <property name="icon_name">go-next-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="linked"/>
+ </style>
+ </object>
+ </child>
+ <child type="title">
+ <object class="GtkStackSwitcher" id="views_switcher">
+ <property name="visible">True</property>
+ <property name="stack">views_stack</property>
</object>
</child>
<child>
- <object class="GtkButton" id="forward_button">
+ <object class="GtkMenuButton" id="menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="popover">win_menu</property>
<property name="receives_default">True</property>
- <property name="action-name">win.next-date</property>
- <accelerator key="Right" modifiers="GDK_MOD1_MASK" signal="clicked"/>
- <accelerator key="Page_Down" signal="clicked"/>
<child>
- <object class="GtkImage" id="go_next_image">
+ <object class="GtkImage" id="menu_image">
<property name="visible">True</property>
- <property name="icon_name">go-next-symbolic</property>
+ <property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
- <style>
- <class name="linked"/>
- </style>
- </object>
- </child>
- <child type="title">
- <object class="GtkStackSwitcher" id="views_switcher">
- <property name="visible">True</property>
- <property name="stack">views_stack</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="popover">win_menu</property>
- <property name="receives_default">True</property>
<child>
- <object class="GtkImage" id="menu_image">
+ <object class="GtkMenuButton" id="calendars_button">
<property name="visible">True</property>
- <property name="icon_name">open-menu-symbolic</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popover">calendar_popover</property>
+ <property name="tooltip_text" translatable="yes">Manage your calendars</property>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GcalSearchButton" id="search_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes" context="tooltip">Search for
events</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="calendars_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="popover">calendar_popover</property>
- <property name="tooltip_text" translatable="yes">Manage your calendars</property>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GcalSearchButton" id="search_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes" context="tooltip">Search for events</property>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
</child>
</object>
</child>
@@ -293,14 +302,14 @@
<signal name="response" handler="edit_dialog_closed" object="GcalWindow" swapped="no"/>
<signal name="delete-event" handler="gtk_widget_hide_on_delete" object="GcalWindow" swapped="no"/>
</object>
-
+
<object class="GtkPopoverMenu" id="win_menu">
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="margin">12</property>
<property name="orientation">vertical</property>
-
+
<!-- About -->
<child>
<object class="GtkModelButton">
@@ -309,7 +318,7 @@
<property name="text" translatable="yes">_Online Accounts…</property>
</object>
</child>
-
+
<!-- Weather -->
<child>
<object class="GtkModelButton">
@@ -318,13 +327,13 @@
<property name="text" translatable="yes">_Weather</property>
</object>
</child>
-
+
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
</object>
</child>
-
+
<!-- Shortcuts -->
<child>
<object class="GtkModelButton">
@@ -333,7 +342,7 @@
<property name="text" translatable="yes">_Keyboard Shortcuts</property>
</object>
</child>
-
+
<!-- About -->
<child>
<object class="GtkModelButton">
@@ -344,7 +353,7 @@
</child>
</object>
</child>
-
+
<!-- Weather submenu -->
<child>
<object class="GcalWeatherSettings" id="weather_settings">
@@ -355,6 +364,6 @@
<property name="submenu">weather</property>
</packing>
</child>
-
+
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]