[recipes] details page: Disable the edit button for readonly recipes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] details page: Disable the edit button for readonly recipes
- Date: Tue, 20 Dec 2016 10:02:38 +0000 (UTC)
commit db57edc34eba2c95eedd143f6ae5a8ddda98295d
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 19 20:18:22 2016 -0500
details page: Disable the edit button for readonly recipes
This prevents us from modifying somebody elses recipe.
https://bugzilla.gnome.org/show_bug.cgi?id=776264
src/gr-details-page.c | 7 +++++++
src/gr-details-page.ui | 2 +-
2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 2f905e2..812b290 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -134,6 +134,7 @@ struct _GrDetailsPage
GtkWidget *duration_stack;
GtkWidget *remaining_time_label;
GtkWidget *chef_label;
+ GtkWidget *edit_button;
};
G_DEFINE_TYPE (GrDetailsPage, gr_details_page, GTK_TYPE_BOX)
@@ -566,6 +567,7 @@ gr_details_page_class_init (GrDetailsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, duration_stack);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, remaining_time_label);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, chef_label);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, edit_button);
gtk_widget_class_bind_template_callback (widget_class, edit_recipe);
gtk_widget_class_bind_template_callback (widget_class, delete_recipe);
@@ -727,6 +729,11 @@ gr_details_page_set_recipe (GrDetailsPage *page,
else {
gtk_widget_hide (page->chef_label);
}
+
+ if (gr_recipe_is_readonly (recipe))
+ gtk_widget_set_sensitive (page->edit_button, FALSE);
+ else
+ gtk_widget_set_sensitive (page->edit_button, TRUE);
}
static void
diff --git a/src/gr-details-page.ui b/src/gr-details-page.ui
index bf0a1a5..1af004f 100644
--- a/src/gr-details-page.ui
+++ b/src/gr-details-page.ui
@@ -360,7 +360,7 @@ followed</property>
</packing>
</child>
<child>
- <object class="GtkButton">
+ <object class="GtkButton" id="edit_button">
<property name="visible">1</property>
<property name="use-underline">1</property>
<property name="label" translatable="yes">_Edit</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]