[nautilus/wip/coreyberla/app-picker-followups: 4/5] app-chooser: Add property filename
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/coreyberla/app-picker-followups: 4/5] app-chooser: Add property filename
- Date: Sat, 6 Aug 2022 03:53:13 +0000 (UTC)
commit 88c6a2be877cd18528cfcca36642b841f0a22c5d
Author: Corey Berla <corey berla me>
Date: Fri Aug 5 13:12:36 2022 -0700
app-chooser: Add property filename
We need this for the description within the app chooser.
If we are working on multiple files, set to NULL.
src/nautilus-app-chooser.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c
index 5cc686726..b9a513e8f 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -17,6 +17,7 @@ struct _NautilusAppChooser
GtkDialog parent_instance;
gchar *content_type;
+ gchar *file_name;
gboolean single_content_type;
GtkWidget *app_chooser_widget_box;
@@ -34,6 +35,7 @@ enum
PROP_0,
PROP_CONTENT_TYPE,
PROP_SINGLE_CONTENT_TYPE,
+ PROP_FILE_NAME,
LAST_PROP
};
@@ -118,6 +120,12 @@ nautilus_app_chooser_set_property (GObject *object,
}
break;
+ case PROP_FILE_NAME:
+ {
+ self->file_name = g_value_dup_string (value);
+ }
+ break;
+
default:
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -202,6 +210,7 @@ nautilus_app_chooser_finalize (GObject *object)
NautilusAppChooser *self = (NautilusAppChooser *) object;
g_clear_pointer (&self->content_type, g_free);
+ g_clear_pointer (&self->file_name, g_free);
G_OBJECT_CLASS (nautilus_app_chooser_parent_class)->finalize (object);
}
@@ -229,6 +238,12 @@ nautilus_app_chooser_class_init (NautilusAppChooserClass *klass)
NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+ g_object_class_install_property (object_class,
+ PROP_FILE_NAME,
+ g_param_spec_string ("file-name", "", "",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
g_object_class_install_property (object_class,
PROP_SINGLE_CONTENT_TYPE,
g_param_spec_boolean ("single-content-type", "", "",
@@ -242,9 +257,12 @@ nautilus_app_chooser_new (GList *files,
{
gboolean single_content_type = TRUE;
g_autofree gchar *content_type = NULL;
+ g_autofree gchar *file_name = NULL;
content_type = nautilus_file_get_mime_type (files->data);
+ file_name = files->next ? NULL : nautilus_file_get_display_name (files->data);
+
for (GList *l = files; l != NULL; l = l->next)
{
g_autofree gchar *temp_mime_type = NULL;
@@ -260,6 +278,7 @@ nautilus_app_chooser_new (GList *files,
"transient-for", parent_window,
"content-type", content_type,
"use-header-bar", TRUE,
+ "file-name", file_name,
"single-content-type", single_content_type,
NULL));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]