edit-dialog: add a button in the headerbar

This button will be used to select the new source of the event.
This commit is contained in:
Georges Basile Stavracas Neto
2016-07-06 18:54:59 -03:00
parent 202ab83782
commit bbcf20cf44
3 changed files with 104 additions and 21 deletions
+21
View File
@@ -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;
}
+76 -19
View File
@@ -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>
@@ -162,24 +221,6 @@
<property name="width">2</property>
</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>
@@ -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>
+7 -2
View File
@@ -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);