From bb0b7d672ea65036d0aa45e91337b61010035551 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 9 Jul 2023 15:36:30 -0700 Subject: [PATCH] sysprof: remove files dialog This is a section now, so purge this. --- src/sysprof/meson.build | 1 - src/sysprof/sysprof-files-dialog.c | 204 ---------------------------- src/sysprof/sysprof-files-dialog.h | 35 ----- src/sysprof/sysprof-files-dialog.ui | 118 ---------------- src/sysprof/sysprof-window.c | 18 --- src/sysprof/sysprof-window.ui | 4 - src/sysprof/sysprof.gresource.xml | 1 - 7 files changed, 381 deletions(-) delete mode 100644 src/sysprof/sysprof-files-dialog.c delete mode 100644 src/sysprof/sysprof-files-dialog.h delete mode 100644 src/sysprof/sysprof-files-dialog.ui diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build index e14790fe..5e1101a4 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -1,7 +1,6 @@ sysprof_sources = [ 'main.c', 'sysprof-application.c', - 'sysprof-files-dialog.c', 'sysprof-files-section.c', 'sysprof-greeter.c', 'sysprof-logs-section.c', diff --git a/src/sysprof/sysprof-files-dialog.c b/src/sysprof/sysprof-files-dialog.c deleted file mode 100644 index dff6cccf..00000000 --- a/src/sysprof/sysprof-files-dialog.c +++ /dev/null @@ -1,204 +0,0 @@ -/* sysprof-files-dialog.c - * - * Copyright 2023 Christian Hergert - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -#include "config.h" - -#include "sysprof-files-dialog.h" - -struct _SysprofFilesDialog -{ - AdwWindow parent_instance; - - SysprofDocument *document; - - GtkColumnView *column_view; - GtkColumnViewColumn *path_column; -}; - -enum { - PROP_0, - PROP_DOCUMENT, - N_PROPS -}; - -G_DEFINE_FINAL_TYPE (SysprofFilesDialog, sysprof_files_dialog, ADW_TYPE_WINDOW) - -static GParamSpec *properties [N_PROPS]; - -static void -sysprof_files_dialog_activate_cb (SysprofFilesDialog *self, - guint position, - GtkColumnView *view) -{ - g_autoptr(SysprofDocumentFile) file = NULL; - g_autoptr(GtkTextBuffer) buffer = NULL; - g_autoptr(GBytes) bytes = NULL; - GtkSelectionModel *model; - GtkWidget *toolbar; - GtkWidget *header_bar; - GtkWidget *scroller; - GtkWidget *text_view; - const char *str; - const char *endptr; - GtkWindow *window; - gsize len; - - g_assert (SYSPROF_IS_FILES_DIALOG (self)); - g_assert (GTK_IS_COLUMN_VIEW (view)); - - model = gtk_column_view_get_model (view); - file = g_list_model_get_item (G_LIST_MODEL (model), position); - bytes = sysprof_document_file_dup_bytes (file); - str = (const char *)g_bytes_get_data (bytes, &len); - endptr = str; - - if (!g_utf8_validate_len (str, len, &endptr) && endptr == str) - return; - - buffer = gtk_text_buffer_new (NULL); - gtk_text_buffer_set_text (buffer, str, endptr - str); - - window = g_object_new (ADW_TYPE_WINDOW, - "transient-for", self, - "default-width", 800, - "default-height", 600, - "title", sysprof_document_file_get_path (file), - NULL); - header_bar = g_object_new (ADW_TYPE_HEADER_BAR, NULL); - toolbar = g_object_new (ADW_TYPE_TOOLBAR_VIEW, - "top-bar-style", ADW_TOOLBAR_RAISED, - NULL); - scroller = g_object_new (GTK_TYPE_SCROLLED_WINDOW, NULL); - text_view = g_object_new (GTK_TYPE_TEXT_VIEW, - "editable", FALSE, - "left-margin", 6, - "right-margin", 6, - "top-margin", 6, - "bottom-margin", 6, - "monospace", TRUE, - "buffer", buffer, - NULL); - - adw_window_set_content (ADW_WINDOW (window), toolbar); - adw_toolbar_view_add_top_bar (ADW_TOOLBAR_VIEW (toolbar), header_bar); - adw_toolbar_view_set_content (ADW_TOOLBAR_VIEW (toolbar), scroller); - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroller), text_view); - - gtk_window_present (window); -} - -static char * -format_size (gpointer unused, - guint64 size) -{ - return g_format_size (size); -} - -static void -sysprof_files_dialog_dispose (GObject *object) -{ - SysprofFilesDialog *self = (SysprofFilesDialog *)object; - - gtk_widget_dispose_template (GTK_WIDGET (self), SYSPROF_TYPE_FILES_DIALOG); - - g_clear_object (&self->document); - - G_OBJECT_CLASS (sysprof_files_dialog_parent_class)->dispose (object); -} - -static void -sysprof_files_dialog_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - SysprofFilesDialog *self = SYSPROF_FILES_DIALOG (object); - - switch (prop_id) - { - case PROP_DOCUMENT: - g_value_set_object (value, self->document); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -sysprof_files_dialog_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - SysprofFilesDialog *self = SYSPROF_FILES_DIALOG (object); - - switch (prop_id) - { - case PROP_DOCUMENT: - self->document = g_value_dup_object (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -sysprof_files_dialog_class_init (SysprofFilesDialogClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->dispose = sysprof_files_dialog_dispose; - object_class->get_property = sysprof_files_dialog_get_property; - object_class->set_property = sysprof_files_dialog_set_property; - - properties[PROP_DOCUMENT] = - g_param_spec_object ("document", NULL, NULL, - SYSPROF_TYPE_DOCUMENT, - (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | 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-files-dialog.ui"); - gtk_widget_class_bind_template_callback (widget_class, sysprof_files_dialog_activate_cb); - gtk_widget_class_bind_template_callback (widget_class, format_size); - gtk_widget_class_bind_template_child (widget_class, SysprofFilesDialog, column_view); - gtk_widget_class_bind_template_child (widget_class, SysprofFilesDialog, path_column); -} - -static void -sysprof_files_dialog_init (SysprofFilesDialog *self) -{ - gtk_widget_init_template (GTK_WIDGET (self)); - - gtk_column_view_sort_by_column (self->column_view, self->path_column, GTK_SORT_ASCENDING); -} - -GtkWidget * -sysprof_files_dialog_new (SysprofDocument *document) -{ - g_return_val_if_fail (SYSPROF_IS_DOCUMENT (document), NULL); - - return g_object_new (SYSPROF_TYPE_FILES_DIALOG, - "document", document, - NULL); -} diff --git a/src/sysprof/sysprof-files-dialog.h b/src/sysprof/sysprof-files-dialog.h deleted file mode 100644 index 6a9f535d..00000000 --- a/src/sysprof/sysprof-files-dialog.h +++ /dev/null @@ -1,35 +0,0 @@ -/* sysprof-files-dialog.h - * - * Copyright 2023 Christian Hergert - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -#pragma once - -#include - -#include - -G_BEGIN_DECLS - -#define SYSPROF_TYPE_FILES_DIALOG (sysprof_files_dialog_get_type()) - -G_DECLARE_FINAL_TYPE (SysprofFilesDialog, sysprof_files_dialog, SYSPROF, FILES_DIALOG, AdwWindow) - -GtkWidget *sysprof_files_dialog_new (SysprofDocument *document); - -G_END_DECLS diff --git a/src/sysprof/sysprof-files-dialog.ui b/src/sysprof/sysprof-files-dialog.ui deleted file mode 100644 index 8b5a8d66..00000000 --- a/src/sysprof/sysprof-files-dialog.ui +++ /dev/null @@ -1,118 +0,0 @@ - - - - diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c index ee387b95..53285d7b 100644 --- a/src/sysprof/sysprof-window.c +++ b/src/sysprof/sysprof-window.c @@ -24,7 +24,6 @@ #include -#include "sysprof-files-dialog.h" #include "sysprof-files-section.h" #include "sysprof-greeter.h" #include "sysprof-logs-section.h" @@ -69,22 +68,6 @@ sysprof_window_open_capture_action (GtkWidget *widget, gtk_window_present (GTK_WINDOW (greeter)); } -static void -sysprof_window_show_embedded_files_action (GtkWidget *widget, - const char *action_name, - GVariant *param) -{ - SysprofWindow *self = (SysprofWindow *)widget; - GtkWidget *dialog; - - g_assert (SYSPROF_IS_WINDOW (self)); - g_assert (SYSPROF_IS_DOCUMENT (self->document)); - - dialog = sysprof_files_dialog_new (self->document); - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self)); - gtk_window_present (GTK_WINDOW (dialog)); -} - static void sysprof_window_show_metadata_action (GtkWidget *widget, const char *action_name, @@ -197,7 +180,6 @@ sysprof_window_class_init (SysprofWindowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-window.ui"); gtk_widget_class_install_action (widget_class, "win.open-capture", NULL, sysprof_window_open_capture_action); - gtk_widget_class_install_action (widget_class, "capture.show-embedded-files", NULL, sysprof_window_show_embedded_files_action); gtk_widget_class_install_action (widget_class, "capture.show-metadata", NULL, sysprof_window_show_metadata_action); g_type_ensure (SYSPROF_TYPE_DOCUMENT); diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui index ec226cbe..1871bd87 100644 --- a/src/sysprof/sysprof-window.ui +++ b/src/sysprof/sysprof-window.ui @@ -155,10 +155,6 @@
- - Show Embedded Files… - capture.show-embedded-files - Show Embedded Metadata… capture.show-metadata diff --git a/src/sysprof/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml index c60a116e..3d3c7e93 100644 --- a/src/sysprof/sysprof.gresource.xml +++ b/src/sysprof/sysprof.gresource.xml @@ -3,7 +3,6 @@ gtk/help-overlay.ui gtk/menus.ui - sysprof-files-dialog.ui sysprof-files-section.ui sysprof-greeter.ui sysprof-logs-section.ui