[gnome-calendar/wip/gbsneto/titlebar-selector: 1/4] edit-dialog: add a button in the headerbar
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/gbsneto/titlebar-selector: 1/4] edit-dialog: add a button in the headerbar
- Date: Wed, 6 Jul 2016 20:22:04 +0000 (UTC)
commit 943603a1882e4a25894647dfa18bf17c1f6dfcd8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jul 6 16:35:17 2016 -0300
edit-dialog: add a button in the headerbar
This button will be used to select the new source of the event.
data/theme/gtk-styles.css | 21 ++++++++++
data/ui/edit-dialog.ui | 95 ++++++++++++++++++++++++++++++++++++---------
src/gcal-edit-dialog.c | 9 +++-
3 files changed, 104 insertions(+), 21 deletions(-)
---
diff --git a/data/theme/gtk-styles.css b/data/theme/gtk-styles.css
index 304fdec..52f4121 100644
--- a/data/theme/gtk-styles.css
+++ b/data/theme/gtk-styles.css
@@ -265,3 +265,24 @@ event-widget.color-light:backdrop {
.calendar-list > list {
border-radius: 4px;
}
+
+/* Edit dialog's header button */
+button.sources-button {
+ border: none;
+ background: transparent;
+ box-shadow: none;
+ padding-bottom: 0;
+ padding-top: 0;
+}
+
+button.sources-button:hover {
+ background: @theme_bg_color;
+ border-bottom: solid 2px @theme_selected_bg_color;
+ box-shadow: none;
+}
+
+button.sources-button:checked {
+ background: @theme_bg_color;
+ border-bottom: solid 2px @theme_selected_bg_color;
+ box-shadow: none;
+}
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index 4d59374..c723237 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -15,7 +15,6 @@
<child type="titlebar">
<object class="GtkHeaderBar" id="titlebar">
<property name="visible">True</property>
- <property name="title" bind-source="summary_entry" bind-property="text" bind-flags="default" />
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">Cancel</property>
@@ -31,6 +30,66 @@
<property name="icon_size">1</property>
</object>
</child>
+ <child type="title">
+ <object class="GtkMenuButton" id="sources_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popover">sources_popover</property>
+ <style>
+ <class name="flat"/>
+ <class name="sources-button"/>
+ </style>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="source_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="title_label_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" bind-source="summary_entry" bind-property="text"
bind-flags="default" />
+ <style>
+ <class name="title"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="subtitle_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="subtitle"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="pan_down_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="icon_name">pan-down-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkButton" id="done_button">
<property name="label" translatable="yes">Done</property>
@@ -163,24 +222,6 @@
</packing>
</child>
<child>
- <object class="GtkMenuButton" id="sources_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">start</property>
- <property name="popover">sources_popover</property>
- <child>
- <object class="GtkImage" id="source_image">
- <property name="visible">True</property>
- <property name="halign">start</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="all_day_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -471,4 +512,20 @@
</object>
</child>
</object>
+ <object class="GtkSizeGroup">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="cancel_button" />
+ <widget name="done_button" />
+ <widget name="sources_button" />
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="source_image" />
+ <widget name="pan_down_image" />
+ <widget name="title_label_box" />
+ </widgets>
+ </object>
</interface>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 5c7b227..186e5b4 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -34,7 +34,11 @@ struct _GcalEditDialog
GcalManager *manager;
+ /* titlebar */
GtkWidget *titlebar;
+ GtkWidget *title_label;
+ GtkWidget *subtitle_label;
+
GtkWidget *lock;
GtkWidget *source_image;
GtkWidget *source_label;
@@ -413,6 +417,8 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, notes_text);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, all_day_check);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, titlebar);
+ gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, title_label);
+ gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, subtitle_label);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, lock);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, source_image);
gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, sources_popover);
@@ -1010,8 +1016,7 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->source_image), pix);
g_object_unref (pix);
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (dialog->titlebar),
- e_source_get_display_name (source));
+ gtk_label_set_label (GTK_LABEL (dialog->subtitle_label), e_source_get_display_name (source));
/* retrieve start and end dates */
date_start = gcal_event_get_date_start (event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]