applications: Make CcInfoRow subclass AdwActionRow
Same case as previous commit
This commit is contained in:
parent
0bab8a6217
commit
9e38b89752
4 changed files with 16 additions and 65 deletions
|
@ -435,7 +435,6 @@
|
|||
<child>
|
||||
<object class="CcInfoRow" id="total">
|
||||
<property name="title" translatable="yes"><b>Total</b></property>
|
||||
<property name="use-markup">1</property>
|
||||
<property name="info">Unknown</property>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -28,7 +28,6 @@ struct _CcInfoRow
|
|||
{
|
||||
GtkListBoxRow parent;
|
||||
|
||||
GtkWidget *title;
|
||||
GtkWidget *info;
|
||||
GtkWidget *expander;
|
||||
|
||||
|
@ -36,13 +35,11 @@ struct _CcInfoRow
|
|||
gboolean link;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CcInfoRow, cc_info_row, GTK_TYPE_LIST_BOX_ROW)
|
||||
G_DEFINE_TYPE (CcInfoRow, cc_info_row, ADW_TYPE_ACTION_ROW)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_TITLE,
|
||||
PROP_USE_MARKUP,
|
||||
PROP_INFO,
|
||||
PROP_HAS_EXPANDER,
|
||||
PROP_IS_LINK,
|
||||
|
@ -59,18 +56,12 @@ cc_info_row_get_property (GObject *object,
|
|||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TITLE:
|
||||
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (row->title)));
|
||||
break;
|
||||
case PROP_INFO:
|
||||
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (row->info)));
|
||||
break;
|
||||
case PROP_HAS_EXPANDER:
|
||||
g_value_set_boolean (value, gtk_widget_get_visible (row->expander));
|
||||
break;
|
||||
case PROP_USE_MARKUP:
|
||||
g_value_set_boolean (value, gtk_label_get_use_markup (GTK_LABEL (row->title)));
|
||||
break;
|
||||
case PROP_IS_LINK:
|
||||
g_value_set_boolean (value, row->link);
|
||||
break;
|
||||
|
@ -104,10 +95,6 @@ cc_info_row_set_property (GObject *object,
|
|||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TITLE:
|
||||
gtk_label_set_label (GTK_LABEL (row->title), g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_INFO:
|
||||
gtk_label_set_label (GTK_LABEL (row->info), g_value_get_string (value));
|
||||
break;
|
||||
|
@ -117,10 +104,6 @@ cc_info_row_set_property (GObject *object,
|
|||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_USE_MARKUP:
|
||||
gtk_label_set_use_markup (GTK_LABEL (row->title), g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_IS_LINK:
|
||||
row->link = g_value_get_boolean (value);
|
||||
update_expander (row);
|
||||
|
@ -147,21 +130,11 @@ cc_info_row_class_init (CcInfoRowClass *klass)
|
|||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/applications/cc-info-row.ui");
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_TITLE,
|
||||
g_param_spec_string ("title", "title", "title",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INFO,
|
||||
g_param_spec_string ("info", "info", "info",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_USE_MARKUP,
|
||||
g_param_spec_boolean ("use-markup", "use-markup", "use-markup",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HAS_EXPANDER,
|
||||
g_param_spec_boolean ("has-expander", "has-expander", "has-expander",
|
||||
|
@ -177,7 +150,6 @@ cc_info_row_class_init (CcInfoRowClass *klass)
|
|||
g_param_spec_boolean ("is-link", "is-link", "is-link",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, CcInfoRow, title);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcInfoRow, info);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcInfoRow, expander);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_INFO_ROW (cc_info_row_get_type())
|
||||
G_DECLARE_FINAL_TYPE (CcInfoRow, cc_info_row, CC, INFO_ROW, GtkListBoxRow)
|
||||
G_DECLARE_FINAL_TYPE (CcInfoRow, cc_info_row, CC, INFO_ROW, AdwActionRow)
|
||||
|
||||
CcInfoRow* cc_info_row_new (void);
|
||||
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="CcInfoRow" parent="GtkListBoxRow">
|
||||
<property name="activatable">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title">
|
||||
<property name="xalign">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
</child>
|
||||
<template class="CcInfoRow" parent="AdwActionRow">
|
||||
<child>
|
||||
<object class="GtkLabel" id="info">
|
||||
<property name="valign">center</property>
|
||||
|
@ -29,11 +14,6 @@
|
|||
<property name="visible">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
|
Loading…
Add table
Reference in a new issue