sysprof: start on icons for sections

This commit is contained in:
Christian Hergert
2023-07-10 14:59:09 -07:00
parent 79f6984e3e
commit fb85c2078e
6 changed files with 98 additions and 13 deletions

View File

@ -0,0 +1,23 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='logviewer-symbolic.svg' height='16' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='0.48.2 r9819' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'>
<metadata id='metadata90'>
<rdf:RDF>
<cc:Work rdf:about=''>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview inkscape:bbox-paths='true' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer9' inkscape:cx='-70.23294' inkscape:cy='-15.428804' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#555753' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='true' showguides='true' inkscape:snap-bbox='false' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='true' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1381' inkscape:window-maximized='1' inkscape:window-width='2560' inkscape:window-x='1600' inkscape:window-y='27' inkscape:zoom='16'>
<inkscape:grid empspacing='2' enabled='true' id='grid4866' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/>
</sodipodi:namedview>
<title id='title9167'>Gnome Symbolic Icon Theme</title>
<defs id='defs7386'/>
<g inkscape:groupmode='layer' id='layer9' inkscape:label='apps' style='display:inline' transform='translate(-203.0002,-195)'>
<path inkscape:connector-curvature='0' d='m 203.0002,195 0,16 0.96875,0 c -0.44927,-0.52508 -0.39088,-0.99184 0.0312,-1.53125 l 2.54465,-2.5209 c -0.3395,-0.58519 -0.54465,-1.25698 -0.54465,-1.9791 0,-2.21358 1.80078,-4.03125 4,-4.03125 2.19923,0 4,1.81767 4,4.03125 0,2.21358 -1.80077,4.03125 -4,4.03125 -0.8092,0 -1.55582,-0.23556 -2.1875,-0.65625 L 205.03145,211 l 12,0 c -0.12596,-0.12596 -0.21875,-0.30779 -0.21875,-0.5 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.19221 -0.0928,0.37404 -0.21875,0.5 l 1,0 0,-16 -1,0 c -0.12596,0.12596 -0.30779,0.21875 -0.5,0.21875 -0.19221,0 -0.34279,-0.0928 -0.46875,-0.21875 l -12.0625,0 c -0.12596,0.12595 -0.27654,0.21875 -0.46875,0.21875 -0.19221,0 -0.37404,-0.0928 -0.5,-0.21875 z m 1.5,0.8125 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m -13,2 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m -13,2 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m -13,2 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m -7.45979,1.20312 c -1.1122,0 -1.99105,0.89617 -1.99105,2.01563 0,1.11946 0.87885,2.01562 1.99105,2.01562 1.1122,0 1.99104,-0.89616 1.99104,-2.01562 0,-1.11946 -0.87884,-2.01563 -1.99104,-2.01563 z m -5.54021,0.79688 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m -13,2 c 0.38442,0 0.6875,0.30308 0.6875,0.6875 0,0.38442 -0.30308,0.71875 -0.6875,0.71875 -0.38442,0 -0.71875,-0.33433 -0.71875,-0.71875 0,-0.38442 0.33433,-0.6875 0.71875,-0.6875 z m 13,0 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z m 0,2 c 0.38442,0 0.71875,0.30308 0.71875,0.6875 0,0.38442 -0.33433,0.71875 -0.71875,0.71875 -0.38442,0 -0.6875,-0.33433 -0.6875,-0.71875 0,-0.38442 0.30308,-0.6875 0.6875,-0.6875 z' id='path10349' sodipodi:nodetypes='cccccsssscccsssccccsccsccssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss' style='fill:#bebebe;fill-opacity:1;stroke:none'/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -26,6 +26,7 @@
typedef struct
{
char *category;
char *icon_name;
char *title;
SysprofSession *session;
} SysprofSectionPrivate;
@ -36,6 +37,7 @@ enum {
PROP_0,
PROP_SESSION,
PROP_CATEGORY,
PROP_ICON_NAME,
PROP_TITLE,
N_PROPS
};
@ -55,6 +57,7 @@ sysprof_section_dispose (GObject *object)
g_clear_object (&priv->session);
g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&priv->category, g_free);
g_clear_pointer (&priv->icon_name, g_free);
G_OBJECT_CLASS (sysprof_section_parent_class)->dispose (object);
}
@ -77,6 +80,10 @@ sysprof_section_get_property (GObject *object,
g_value_set_string (value, sysprof_section_get_category (self));
break;
case PROP_ICON_NAME:
g_value_set_string (value, sysprof_section_get_icon_name (self));
break;
case PROP_TITLE:
g_value_set_string (value, sysprof_section_get_title (self));
break;
@ -104,6 +111,10 @@ sysprof_section_set_property (GObject *object,
sysprof_section_set_category (self, g_value_get_string (value));
break;
case PROP_ICON_NAME:
sysprof_section_set_icon_name (self, g_value_get_string (value));
break;
case PROP_TITLE:
sysprof_section_set_title (self, g_value_get_string (value));
break;
@ -138,6 +149,11 @@ sysprof_section_class_init (SysprofSectionClass *klass)
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
properties[PROP_ICON_NAME] =
g_param_spec_string ("icon-name", NULL, NULL,
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
@ -214,3 +230,25 @@ sysprof_section_set_category (SysprofSection *self,
if (g_set_str (&priv->category, category))
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORY]);
}
const char *
sysprof_section_get_icon_name (SysprofSection *self)
{
SysprofSectionPrivate *priv = sysprof_section_get_instance_private (self);
g_return_val_if_fail (SYSPROF_IS_SECTION (self), NULL);
return priv->icon_name;
}
void
sysprof_section_set_icon_name (SysprofSection *self,
const char *icon_name)
{
SysprofSectionPrivate *priv = sysprof_section_get_instance_private (self);
g_return_if_fail (SYSPROF_IS_SECTION (self));
if (g_set_str (&priv->icon_name, icon_name))
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICON_NAME]);
}

View File

@ -35,14 +35,17 @@ struct _SysprofSectionClass
GtkWidgetClass parent_class;
};
SysprofSession *sysprof_section_get_session (SysprofSection *self);
void sysprof_section_set_session (SysprofSection *self,
SysprofSession *session);
const char *sysprof_section_get_category (SysprofSection *self);
void sysprof_section_set_category (SysprofSection *self,
const char *category);
const char *sysprof_section_get_title (SysprofSection *self);
void sysprof_section_set_title (SysprofSection *self,
const char *title);
SysprofSession *sysprof_section_get_session (SysprofSection *self);
void sysprof_section_set_session (SysprofSection *self,
SysprofSession *session);
const char *sysprof_section_get_category (SysprofSection *self);
void sysprof_section_set_category (SysprofSection *self,
const char *category);
const char *sysprof_section_get_icon_name (SysprofSection *self);
void sysprof_section_set_icon_name (SysprofSection *self,
const char *icon_name);
const char *sysprof_section_get_title (SysprofSection *self);
void sysprof_section_set_title (SysprofSection *self,
const char *title);
G_END_DECLS

View File

@ -48,16 +48,31 @@ sysprof_sidebar_create_row (gpointer item,
SysprofSidebar *sidebar = user_data;
SysprofSection *section;
GtkListBoxRow *row;
GtkImage *image;
GtkLabel *label;
GtkBox *box;
g_assert (GTK_IS_STACK_PAGE (page));
g_assert (SYSPROF_IS_SIDEBAR (sidebar));
section = SYSPROF_SECTION (gtk_stack_page_get_child (page));
box = g_object_new (GTK_TYPE_BOX,
"orientation", GTK_ORIENTATION_HORIZONTAL,
"spacing", 6,
NULL);
label = g_object_new (GTK_TYPE_LABEL,
"xalign", .0f,
"label", sysprof_section_get_title (section),
NULL);
image = g_object_new (GTK_TYPE_IMAGE,
"icon-name", sysprof_section_get_icon_name (section),
NULL);
gtk_box_append (box, GTK_WIDGET (image));
gtk_box_append (box, GTK_WIDGET (label));
row = g_object_new (GTK_TYPE_LIST_BOX_ROW,
"child", g_object_new (GTK_TYPE_LABEL,
"xalign", .0f,
"label", sysprof_section_get_title (section),
NULL),
"child", box,
NULL);
g_object_set_data_full (G_OBJECT (row), "SECTION", g_object_ref (section), g_object_unref);

View File

@ -100,6 +100,7 @@
<child>
<object class="SysprofSamplesSection">
<property name="category">callgraph</property>
<property name="icon-name">org.gnome.Sysprof-symbolic</property>
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>
@ -116,6 +117,7 @@
<child>
<object class="SysprofLogsSection">
<property name="category">processes</property>
<property name="icon-name">system-log-symbolic</property>
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>
@ -124,6 +126,7 @@
<child>
<object class="SysprofMarksSection">
<property name="category">processes</property>
<property name="icon-name">mark-chart-symbolic</property>
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>
@ -132,6 +135,7 @@
<child>
<object class="SysprofProcessesSection">
<property name="category">processes</property>
<property name="icon-name">application-x-executable-symbolic</property>
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>
@ -140,6 +144,7 @@
<child>
<object class="SysprofFilesSection">
<property name="category">auxiliary</property>
<property name="icon-name">folder-symbolic</property>
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>

View File

@ -16,5 +16,6 @@
<file preprocess="xml-stripblanks">sysprof-window.ui</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/mark-chart-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/mark-table-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/system-log-symbolic.svg</file>
</gresource>
</gresources>