window: move arrow buttons to headerbar
This is part of the ongoing efforts to fit Calendar with the latest designs.
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
52fc61a1a5
commit
2970729324
+5
-69
@@ -1,72 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.1 -->
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.10 -->
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<template class="GcalNavBar" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="nav_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="back_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<style>
|
||||
<class name="nav-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-previous-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="forward_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<style>
|
||||
<class name="nav-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-next-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="left_label">
|
||||
<property name="visible">True</property>
|
||||
@@ -76,10 +16,8 @@
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -87,17 +25,15 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<style>
|
||||
<class name="nav-header"/>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</template>
|
||||
|
||||
+67
-12
@@ -26,8 +26,7 @@
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
|
||||
<signal name="notify::search-mode-enabled" handler="search_toggled" object="GcalWindow" swapped="no"/>
|
||||
<signal name="notify::search-mode-enabled" handler="search_toggled" object="GcalWindow" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkGrid" id="search_entry_grid">
|
||||
<property name="visible">True</property>
|
||||
@@ -42,7 +41,7 @@
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<signal name="search-changed" handler="search_changed" object="GcalWindow" swapped="no"/>
|
||||
<signal name="search-changed" handler="search_changed" object="GcalWindow" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
@@ -65,8 +64,11 @@
|
||||
<property name="vexpand">True</property>
|
||||
<property name="transition_duration">250</property>
|
||||
<property name="transition_type">slide-left-right</property>
|
||||
<signal name="notify::visible-child" handler="view_changed" object="GcalWindow" swapped="no"/>
|
||||
<signal name="notify::transition-running" handler="stack_transition_running" object="GcalWindow" swapped="no"/>
|
||||
<signal name="notify::transition-running" handler="stack_transition_running" object="GcalWindow" swapped="no"/>
|
||||
<signal name="notify::visible-child" handler="view_changed" object="GcalWindow" swapped="no"/>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<style>
|
||||
<class name="views"/>
|
||||
</style>
|
||||
@@ -97,12 +99,66 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="today_button">
|
||||
<property name="label" translatable="yes">Today</property>
|
||||
<object class="GtkBox" id="button_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="date_updated" object="GcalWindow" swapped="no"/>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="back_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="date_updated" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="go_back_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-previous-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</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>
|
||||
<signal name="clicked" handler="date_updated" object="GcalWindow" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</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>
|
||||
<signal name="clicked" handler="date_updated" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="go_next_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">go-next-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
@@ -117,12 +173,11 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_popover">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="menu_image">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">open-menu-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -87,8 +87,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/nav_bar.ui");
|
||||
|
||||
/* Bind internals widgets */
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, back_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, forward_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, left_label);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNavBar, right_label);
|
||||
}
|
||||
@@ -164,21 +162,3 @@ gcal_nav_bar_new (void)
|
||||
{
|
||||
return g_object_new (GCAL_TYPE_NAV_BAR, NULL);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar)
|
||||
{
|
||||
GcalNavBarPrivate *priv;
|
||||
|
||||
priv = gcal_nav_bar_get_instance_private (nav_bar);
|
||||
return priv->back_button;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gcal_nav_bar_get_next_button (GcalNavBar *nav_bar)
|
||||
{
|
||||
GcalNavBarPrivate *priv;
|
||||
|
||||
priv = gcal_nav_bar_get_instance_private (nav_bar);
|
||||
return priv->forward_button;
|
||||
}
|
||||
|
||||
@@ -48,10 +48,6 @@ GType gcal_nav_bar_get_type (void);
|
||||
|
||||
GtkWidget* gcal_nav_bar_new (void);
|
||||
|
||||
GtkWidget* gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar);
|
||||
|
||||
GtkWidget* gcal_nav_bar_get_next_button (GcalNavBar *nav_bar);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GCAL_NAV_BAR_H__ */
|
||||
|
||||
+5
-6
@@ -70,7 +70,9 @@ typedef struct
|
||||
GtkWidget *menu_button;
|
||||
GtkWidget *search_button;
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *back_button;
|
||||
GtkWidget *today_button;
|
||||
GtkWidget *forward_button;
|
||||
GtkWidget *views_switcher;
|
||||
|
||||
/* day, week, month, year, list, search */
|
||||
@@ -235,7 +237,7 @@ date_updated (GtkButton *button,
|
||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||
|
||||
move_today = priv->today_button == (GtkWidget*) button;
|
||||
move_back = gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)) == (GtkWidget*) button;
|
||||
move_back = priv->back_button == (GtkWidget*) button;
|
||||
|
||||
if (move_today)
|
||||
{
|
||||
@@ -974,7 +976,9 @@ gcal_window_class_init(GcalWindowClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_bar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_entry);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, back_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, today_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, forward_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, views_overlay);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, views_stack);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, views_switcher);
|
||||
@@ -1109,11 +1113,6 @@ gcal_window_constructed (GObject *object)
|
||||
G_CALLBACK (event_activated), object);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)),
|
||||
"clicked", G_CALLBACK (date_updated), object);
|
||||
g_signal_connect (gcal_nav_bar_get_next_button (GCAL_NAV_BAR (priv->nav_bar)),
|
||||
"clicked", G_CALLBACK (date_updated), object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user