mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
sysprof: remove files dialog
This is a section now, so purge this.
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
sysprof_sources = [
|
sysprof_sources = [
|
||||||
'main.c',
|
'main.c',
|
||||||
'sysprof-application.c',
|
'sysprof-application.c',
|
||||||
'sysprof-files-dialog.c',
|
|
||||||
'sysprof-files-section.c',
|
'sysprof-files-section.c',
|
||||||
'sysprof-greeter.c',
|
'sysprof-greeter.c',
|
||||||
'sysprof-logs-section.c',
|
'sysprof-logs-section.c',
|
||||||
|
|||||||
@ -1,204 +0,0 @@
|
|||||||
/* sysprof-files-dialog.c
|
|
||||||
*
|
|
||||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
/* sysprof-files-dialog.h
|
|
||||||
*
|
|
||||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <adwaita.h>
|
|
||||||
|
|
||||||
#include <sysprof-analyze.h>
|
|
||||||
|
|
||||||
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
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<interface>
|
|
||||||
<template class="SysprofFilesDialog" parent="AdwWindow">
|
|
||||||
<property name="default-width">600</property>
|
|
||||||
<property name="default-height">400</property>
|
|
||||||
<child>
|
|
||||||
<object class="AdwToolbarView">
|
|
||||||
<property name="top-bar-style">raised</property>
|
|
||||||
<child type="top">
|
|
||||||
<object class="AdwHeaderBar">
|
|
||||||
<property name="title-widget">
|
|
||||||
<object class="AdwWindowTitle">
|
|
||||||
<property name="title" translatable="yes">Captured Files</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<property name="content">
|
|
||||||
<object class="GtkScrolledWindow">
|
|
||||||
<child>
|
|
||||||
<object class="GtkColumnView" id="column_view">
|
|
||||||
<signal name="activate" handler="sysprof_files_dialog_activate_cb" swapped="true"/>
|
|
||||||
<property name="show-row-separators">true</property>
|
|
||||||
<property name="model">
|
|
||||||
<object class="GtkNoSelection">
|
|
||||||
<property name="model">
|
|
||||||
<object class="GtkSortListModel">
|
|
||||||
<binding name="sorter">
|
|
||||||
<lookup name="sorter">column_view</lookup>
|
|
||||||
</binding>
|
|
||||||
<binding name="model">
|
|
||||||
<lookup name="files" type="SysprofDocument">
|
|
||||||
<lookup name="document">SysprofFilesDialog</lookup>
|
|
||||||
</lookup>
|
|
||||||
</binding>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColumnViewColumn" id="path_column">
|
|
||||||
<property name="title" translatable="yes">Path</property>
|
|
||||||
<property name="expand">true</property>
|
|
||||||
<property name="sorter">
|
|
||||||
<object class="GtkStringSorter">
|
|
||||||
<property name="expression">
|
|
||||||
<lookup name="path" type="SysprofDocumentFile"/>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
<property name="factory">
|
|
||||||
<object class="GtkBuilderListItemFactory">
|
|
||||||
<property name="bytes"><![CDATA[
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<interface>
|
|
||||||
<template class="GtkListItem">
|
|
||||||
<property name="child">
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<binding name="label">
|
|
||||||
<lookup name="path" type="SysprofDocumentFile">
|
|
||||||
<lookup name="item">GtkListItem</lookup>
|
|
||||||
</lookup>
|
|
||||||
</binding>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</template>
|
|
||||||
</interface>
|
|
||||||
]]>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColumnViewColumn" id="size_column">
|
|
||||||
<property name="title" translatable="yes">Size</property>
|
|
||||||
<property name="sorter">
|
|
||||||
<object class="GtkNumericSorter">
|
|
||||||
<property name="expression">
|
|
||||||
<lookup name="size" type="SysprofDocumentFile"/>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
<property name="factory">
|
|
||||||
<object class="GtkBuilderListItemFactory">
|
|
||||||
<property name="bytes"><![CDATA[
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<interface>
|
|
||||||
<template class="GtkListItem">
|
|
||||||
<property name="child">
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<binding name="label">
|
|
||||||
<closure type="gchararray" function="format_size">
|
|
||||||
<lookup name="size" type="SysprofDocumentFile">
|
|
||||||
<lookup name="item">GtkListItem</lookup>
|
|
||||||
</lookup>
|
|
||||||
</closure>
|
|
||||||
</binding>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</template>
|
|
||||||
</interface>
|
|
||||||
]]>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</template>
|
|
||||||
</interface>
|
|
||||||
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include <sysprof-gtk.h>
|
#include <sysprof-gtk.h>
|
||||||
|
|
||||||
#include "sysprof-files-dialog.h"
|
|
||||||
#include "sysprof-files-section.h"
|
#include "sysprof-files-section.h"
|
||||||
#include "sysprof-greeter.h"
|
#include "sysprof-greeter.h"
|
||||||
#include "sysprof-logs-section.h"
|
#include "sysprof-logs-section.h"
|
||||||
@ -69,22 +68,6 @@ sysprof_window_open_capture_action (GtkWidget *widget,
|
|||||||
gtk_window_present (GTK_WINDOW (greeter));
|
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
|
static void
|
||||||
sysprof_window_show_metadata_action (GtkWidget *widget,
|
sysprof_window_show_metadata_action (GtkWidget *widget,
|
||||||
const char *action_name,
|
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_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, "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);
|
gtk_widget_class_install_action (widget_class, "capture.show-metadata", NULL, sysprof_window_show_metadata_action);
|
||||||
|
|
||||||
g_type_ensure (SYSPROF_TYPE_DOCUMENT);
|
g_type_ensure (SYSPROF_TYPE_DOCUMENT);
|
||||||
|
|||||||
@ -155,10 +155,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">Show Embedded Files…</attribute>
|
|
||||||
<attribute name="action">capture.show-embedded-files</attribute>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Show Embedded Metadata…</attribute>
|
<attribute name="label" translatable="yes">Show Embedded Metadata…</attribute>
|
||||||
<attribute name="action">capture.show-metadata</attribute>
|
<attribute name="action">capture.show-metadata</attribute>
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
<gresource prefix="/org/gnome/sysprof">
|
<gresource prefix="/org/gnome/sysprof">
|
||||||
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
||||||
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
|
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
|
||||||
<file preprocess="xml-stripblanks">sysprof-files-dialog.ui</file>
|
|
||||||
<file preprocess="xml-stripblanks">sysprof-files-section.ui</file>
|
<file preprocess="xml-stripblanks">sysprof-files-section.ui</file>
|
||||||
<file preprocess="xml-stripblanks">sysprof-greeter.ui</file>
|
<file preprocess="xml-stripblanks">sysprof-greeter.ui</file>
|
||||||
<file preprocess="xml-stripblanks">sysprof-logs-section.ui</file>
|
<file preprocess="xml-stripblanks">sysprof-logs-section.ui</file>
|
||||||
|
|||||||
Reference in New Issue
Block a user