mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: tweak empty state and add icon-name property
This commit is contained in:
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
GtkImage *image;
|
||||||
GtkLabel *title;
|
GtkLabel *title;
|
||||||
GtkLabel *subtitle;
|
GtkLabel *subtitle;
|
||||||
} SysprofEmptyStateViewPrivate;
|
} SysprofEmptyStateViewPrivate;
|
||||||
@ -38,6 +39,7 @@ enum {
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_TITLE,
|
PROP_TITLE,
|
||||||
PROP_SUBTITLE,
|
PROP_SUBTITLE,
|
||||||
|
PROP_ICON_NAME,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -51,9 +53,9 @@ sysprof_empty_state_view_new (void)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sysprof_empty_state_view_action (GtkWidget *widget,
|
sysprof_empty_state_view_action (GtkWidget *widget,
|
||||||
const gchar *prefix,
|
const gchar *prefix,
|
||||||
const gchar *action_name,
|
const gchar *action_name,
|
||||||
GVariant *parameter)
|
GVariant *parameter)
|
||||||
{
|
{
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
GApplication *app;
|
GApplication *app;
|
||||||
@ -97,8 +99,8 @@ sysprof_empty_state_view_action (GtkWidget *widget,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
|
sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
|
||||||
const gchar *uri,
|
const gchar *uri,
|
||||||
GtkLabel *label)
|
GtkLabel *label)
|
||||||
{
|
{
|
||||||
g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
|
g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
|
||||||
g_assert (uri != NULL);
|
g_assert (uri != NULL);
|
||||||
@ -143,15 +145,21 @@ sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_empty_state_view_set_property (GObject *object,
|
sysprof_empty_state_view_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
|
SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
|
||||||
SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
|
SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_ICON_NAME:
|
||||||
|
g_object_set (priv->image,
|
||||||
|
"icon-name", g_value_get_string (value),
|
||||||
|
NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
gtk_label_set_label (priv->title, g_value_get_string (value));
|
gtk_label_set_label (priv->title, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
@ -173,17 +181,18 @@ sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
|
|||||||
|
|
||||||
object_class->set_property = sysprof_empty_state_view_set_property;
|
object_class->set_property = sysprof_empty_state_view_set_property;
|
||||||
|
|
||||||
|
properties [PROP_ICON_NAME] =
|
||||||
|
g_param_spec_string ("icon-name", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_TITLE] =
|
properties [PROP_TITLE] =
|
||||||
g_param_spec_string ("title",
|
g_param_spec_string ("title", NULL, NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
NULL,
|
||||||
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_SUBTITLE] =
|
properties [PROP_SUBTITLE] =
|
||||||
g_param_spec_string ("subtitle",
|
g_param_spec_string ("subtitle", NULL, NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
NULL,
|
||||||
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
@ -192,6 +201,7 @@ sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
|
|||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-empty-state-view.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-empty-state-view.ui");
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, subtitle);
|
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, subtitle);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, title);
|
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, title);
|
||||||
|
gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<child type="center">
|
<child type="center">
|
||||||
<object class="GtkImage">
|
<object class="GtkImage" id="image">
|
||||||
<property name="icon-name">org.gnome.Sysprof-symbolic</property>
|
<property name="icon-name">org.gnome.Sysprof-symbolic</property>
|
||||||
<property name="pixel-size">256</property>
|
<property name="pixel-size">192</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user