diff options
author | Apoorv Sachan <apoorv.99.sachan@gmail.com> | 2020-06-19 17:01:05 +0530 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2020-08-05 13:48:10 +0000 |
commit | bb34ea769d1acc38f20d0fb7a1fcf73f70da27d9 (patch) | |
tree | 914d6f779c82bf38b3226fee1f68adce74a851f6 | |
parent | cadcd20e29e335b7b6dbc3b1e4b79216c327b9b1 (diff) | |
download | nautilus-bb34ea769d1acc38f20d0fb7a1fcf73f70da27d9.tar.gz |
properties-window: Add conditional prompt labels to the template
Also document the code generating label text containing file names.
-rw-r--r-- | src/nautilus-properties-window.c | 28 | ||||
-rw-r--r-- | src/resources/ui/nautilus-properties-window.ui | 41 |
2 files changed, 59 insertions, 10 deletions
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index 4f1e71826..61a10e881 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -156,6 +156,11 @@ struct _NautilusPropertiesWindow GtkWidget *permissions_box; GtkWidget *permissions_grid; + GtkWidget *bottom_prompt_seperator; + GtkWidget *not_the_owner_label; + + GtkWidget *permission_indeterminable_label; + GroupChange *group_change; OwnerChange *owner_change; @@ -4603,9 +4608,8 @@ setup_permissions_page (NautilusPropertiesWindow *window) if (!all_can_set_permissions (file_list)) { - add_prompt_and_separator ( - window->permissions_box, - _("You are not the owner, so you cannot change these permissions.")); + gtk_widget_show (window->not_the_owner_label); + gtk_widget_show (window->bottom_prompt_seperator); } gtk_widget_show (window->permissions_grid); @@ -4640,19 +4644,22 @@ setup_permissions_page (NautilusPropertiesWindow *window) } else { + /* + * This if block only gets executed if its a single file window, + * in which case the label text needs to be different from the + * default label text. The default label text for a multifile + * window is set in nautilus-properties-window.ui so no else block. + */ if (!is_multi_file_window (window)) { file_name = nautilus_file_get_display_name (get_target_file (window)); prompt_text = g_strdup_printf (_("The permissions of “%s” could not be determined."), file_name); + gtk_label_set_text (GTK_LABEL (window->permission_indeterminable_label), prompt_text); g_free (file_name); - } - else - { - prompt_text = g_strdup (_("The permissions of the selected file could not be determined.")); + g_free (prompt_text); } - add_prompt (window->permissions_box, prompt_text, TRUE); - g_free (prompt_text); + gtk_widget_show (window->permission_indeterminable_label); } } @@ -5709,6 +5716,9 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass) gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, file_system_value); gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permissions_box); gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permissions_grid); + gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, bottom_prompt_seperator); + gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, not_the_owner_label); + gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permission_indeterminable_label); } static void diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui index 523834cb8..409a4e613 100644 --- a/src/resources/ui/nautilus-properties-window.ui +++ b/src/resources/ui/nautilus-properties-window.ui @@ -677,6 +677,45 @@ <property name="border_width">12</property> <property name="orientation">vertical</property> <child> + <object class="GtkLabel" id="not_the_owner_label"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">You are not the owner, so you cannot change these permissions.</property> + <property name="wrap">True</property> + <property name="max_width_chars">40</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="bottom_prompt_seperator"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">12</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="permission_indeterminable_label"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">The permissions of the selected file could not be determined.</property> + <property name="wrap">True</property> + <property name="max_width_chars">40</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> <object class="GtkGrid" id="permissions_grid"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -693,7 +732,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">4</property> </packing> </child> </object> |