From 79fe14a5871c82715a4772c1a0f4290938181d36 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 7 Aug 2023 13:39:14 -0700 Subject: [PATCH] sysprof: open files I wanted to have the ability to ignore bundled symbols and provide a custom kallsyms to help with some perculiar situations, but we might need to defer that to a preferences window. --- src/sysprof/sysprof-greeter.c | 64 ++--------------------------------- 1 file changed, 3 insertions(+), 61 deletions(-) diff --git a/src/sysprof/sysprof-greeter.c b/src/sysprof/sysprof-greeter.c index 6e6269df..731f7b15 100644 --- a/src/sysprof/sysprof-greeter.c +++ b/src/sysprof/sysprof-greeter.c @@ -31,6 +31,7 @@ #include "sysprof-power-profiles.h" #include "sysprof-recording-pad.h" #include "sysprof-recording-template.h" +#include "sysprof-window.h" G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCaptureWriter, sysprof_capture_writer_unref) @@ -38,7 +39,6 @@ struct _SysprofGreeter { AdwWindow parent_instance; - GFile *file; GtkStringList *envvars; AdwViewStack *view_stack; @@ -59,16 +59,8 @@ struct _SysprofGreeter SysprofRecordingTemplate *recording_template; }; -enum { - PROP_0, - PROP_FILE, - N_PROPS -}; - G_DEFINE_FINAL_TYPE (SysprofGreeter, sysprof_greeter, ADW_TYPE_WINDOW) -static GParamSpec *properties [N_PROPS]; - #define STRV_INIT(...) (const char * const[]){__VA_ARGS__,NULL} static inline gboolean @@ -327,8 +319,8 @@ sysprof_greeter_choose_file_for_open_cb (GObject *object, { if (g_file_is_native (file)) { - if (g_set_object (&self->file, file)) - g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FILE]); + sysprof_window_open (SYSPROF_APPLICATION_DEFAULT, file); + gtk_window_destroy (GTK_WINDOW (self)); } else { @@ -369,9 +361,6 @@ sysprof_greeter_select_file_action (GtkWidget *widget, g_list_store_append (filters, filter); gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters)); - if (self->file) - gtk_file_dialog_set_initial_file (dialog, self->file); - gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, @@ -535,44 +524,6 @@ sysprof_greeter_dispose (GObject *object) G_OBJECT_CLASS (sysprof_greeter_parent_class)->dispose (object); } -static void -sysprof_greeter_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - SysprofGreeter *self = SYSPROF_GREETER (object); - - switch (prop_id) - { - case PROP_FILE: - g_value_set_object (value, self->file); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -sysprof_greeter_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - SysprofGreeter *self = SYSPROF_GREETER (object); - - switch (prop_id) - { - case PROP_FILE: - g_set_object (&self->file, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - static void sysprof_greeter_class_init (SysprofGreeterClass *klass) { @@ -580,15 +531,6 @@ sysprof_greeter_class_init (SysprofGreeterClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->dispose = sysprof_greeter_dispose; - object_class->get_property = sysprof_greeter_get_property; - object_class->set_property = sysprof_greeter_set_property; - - properties [PROP_FILE] = - g_param_spec_object ("file", NULL, NULL, - G_TYPE_FILE, - (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_properties (object_class, N_PROPS, properties); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-greeter.ui");