source-dialog: toggle some widgets' visibility when changing mode
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
143444ddd5
commit
77b7f116da
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
GtkWidget *add_button;
|
||||||
|
GtkWidget *cancel_button;
|
||||||
GtkWidget *headerbar;
|
GtkWidget *headerbar;
|
||||||
GtkWidget *stack;
|
GtkWidget *stack;
|
||||||
|
|
||||||
@@ -119,6 +121,8 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
|
|||||||
/* bind things for/from the template class */
|
/* bind things for/from the template class */
|
||||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/source-dialog.ui");
|
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/source-dialog.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, add_button);
|
||||||
|
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, cancel_button);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, headerbar);
|
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, headerbar);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
|
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
|
||||||
}
|
}
|
||||||
@@ -166,8 +170,16 @@ gcal_source_dialog_set_mode (GcalSourceDialog *dialog,
|
|||||||
GcalSourceDialogMode mode)
|
GcalSourceDialogMode mode)
|
||||||
{
|
{
|
||||||
GcalSourceDialogPrivate *priv = dialog->priv;
|
GcalSourceDialogPrivate *priv = dialog->priv;
|
||||||
|
gboolean edit_mode;
|
||||||
|
|
||||||
priv->mode = mode;
|
priv->mode = mode;
|
||||||
|
edit_mode = (mode == GCAL_SOURCE_DIALOG_MODE_EDIT);
|
||||||
|
|
||||||
/* TODO: change UI */
|
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (priv->headerbar), edit_mode);
|
||||||
|
gtk_widget_set_visible (priv->cancel_button, !edit_mode);
|
||||||
|
gtk_widget_set_visible (priv->add_button, !edit_mode);
|
||||||
|
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), edit_mode ? "edit" : "create");
|
||||||
|
|
||||||
|
if (!edit_mode)
|
||||||
|
gtk_header_bar_set_title (GTK_HEADER_BAR (priv->headerbar), "Add Calendar");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user