diff --git a/panels/common/cc-list-row.c b/panels/common/cc-list-row.c new file mode 100644 index 0000000000000000000000000000000000000000..20ee00260e8819639de64f28db9c17d3b9e2c82c --- /dev/null +++ b/panels/common/cc-list-row.c @@ -0,0 +1,362 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* cc-list-row.c + * + * Copyright 2019 Purism SPC + * + * 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 . + * + * Author(s): + * Mohammed Sadiq + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#undef G_LOG_DOMAIN +#define G_LOG_DOMAIN "cc-list-row" + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "cc-list-row.h" + +struct _CcListRow +{ + GtkListBoxRow parent_instance; + + GtkBox *box; + GtkLabel *title; + GtkLabel *subtitle; + GtkLabel *secondary_label; + GtkImage *icon; + + GtkSwitch *enable_switch; + gboolean show_switch; + + gboolean switch_active; +}; + +G_DEFINE_TYPE (CcListRow, cc_list_row, GTK_TYPE_LIST_BOX_ROW) + + +enum { + PROP_0, + PROP_TITLE, + PROP_SUBTITLE, + PROP_SECONDARY_LABEL, + PROP_ICON_NAME, + PROP_SHOW_SWITCH, + PROP_ACTIVE, + PROP_USE_UNDERLINE, + N_PROPS +}; + +static GParamSpec *properties[N_PROPS]; + +static void +cc_list_row_activated_cb (CcListRow *self, + GtkListBoxRow *row) +{ + g_assert (CC_IS_LIST_ROW (self)); + + if (!self->show_switch || row != GTK_LIST_BOX_ROW (self)) + return; + + cc_list_row_activate (self); +} + +static void +cc_list_row_parent_changed_cb (CcListRow *self) +{ + GtkWidget *parent; + + g_assert (CC_IS_LIST_ROW (self)); + + parent = gtk_widget_get_parent (GTK_WIDGET (self)); + + if (!parent) + return; + + g_return_if_fail (GTK_IS_LIST_BOX (parent)); + g_signal_connect_object (parent, "row-activated", + G_CALLBACK (cc_list_row_activated_cb), + self, G_CONNECT_SWAPPED); +} + +static void +cc_list_row_switch_active_cb (CcListRow *self) +{ + gboolean switch_active; + + g_assert (CC_IS_LIST_ROW (self)); + g_assert (self->show_switch); + + switch_active = gtk_switch_get_active (self->enable_switch); + + if (switch_active == self->switch_active) + return; + + self->switch_active = switch_active; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIVE]); +} + +static void +cc_list_row_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + CcListRow *self = (CcListRow *)object; + + switch (prop_id) + { + case PROP_SECONDARY_LABEL: + g_value_set_string (value, gtk_label_get_label (self->secondary_label)); + break; + + case PROP_ACTIVE: + g_value_set_boolean (value, self->switch_active); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +cc_list_row_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + CcListRow *self = (CcListRow *)object; + gint margin; + + switch (prop_id) + { + case PROP_TITLE: + gtk_label_set_label (self->title, g_value_get_string (value)); + break; + + case PROP_SUBTITLE: + gtk_widget_set_visible (GTK_WIDGET (self->subtitle), + g_value_get_string (value) != NULL); + gtk_label_set_label (self->subtitle, g_value_get_string (value)); + if (g_value_get_string (value) != NULL) + margin = 6; + else + margin = 12; + g_object_set (self->box, + "margin-top", margin, + "margin-bottom", margin, + NULL); + break; + + case PROP_SECONDARY_LABEL: + gtk_label_set_label (self->secondary_label, g_value_get_string (value)); + break; + + case PROP_ICON_NAME: + cc_list_row_set_icon_name (self, g_value_get_string (value)); + break; + + case PROP_SHOW_SWITCH: + cc_list_row_set_show_switch (self, g_value_get_boolean (value)); + break; + + case PROP_USE_UNDERLINE: + gtk_label_set_use_underline (self->title, g_value_get_boolean (value)); + gtk_label_set_use_underline (self->subtitle, g_value_get_boolean (value)); + gtk_label_set_mnemonic_widget (self->title, GTK_WIDGET (self)); + gtk_label_set_mnemonic_widget (self->subtitle, GTK_WIDGET (self)); + break; + + case PROP_ACTIVE: + g_signal_handlers_block_by_func (self->enable_switch, + cc_list_row_switch_active_cb, self); + gtk_switch_set_active (self->enable_switch, + g_value_get_boolean (value)); + self->switch_active = g_value_get_boolean (value); + g_signal_handlers_unblock_by_func (self->enable_switch, + cc_list_row_switch_active_cb, self); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +cc_list_row_class_init (CcListRowClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->get_property = cc_list_row_get_property; + object_class->set_property = cc_list_row_set_property; + + properties[PROP_TITLE] = + g_param_spec_string ("title", + "Title", + "List row primary title", + NULL, + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); + + properties[PROP_SUBTITLE] = + g_param_spec_string ("subtitle", + "Subtitle", + "List row primary subtitle", + NULL, + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); + + properties[PROP_SECONDARY_LABEL] = + g_param_spec_string ("secondary-label", + "Secondary Label", + "Set Secondary Label", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + properties[PROP_ICON_NAME] = + g_param_spec_string ("icon-name", + "Icon Name", + "Secondary Icon name", + NULL, + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); + + properties[PROP_SHOW_SWITCH] = + g_param_spec_boolean ("show-switch", + "Show Switch", + "Whether to show a switch at the end of row", + FALSE, + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); + + properties[PROP_ACTIVE] = + g_param_spec_boolean ("active", + "Active", + "The active state of the switch", + FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + properties[PROP_USE_UNDERLINE] = + g_param_spec_boolean ("use-underline", + "Use underline", + "If set, text prefixed with underline shall be used as mnemonic", + FALSE, + G_PARAM_WRITABLE | 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/control-center/" + "common/cc-list-row.ui"); + + gtk_widget_class_bind_template_child (widget_class, CcListRow, box); + gtk_widget_class_bind_template_child (widget_class, CcListRow, title); + gtk_widget_class_bind_template_child (widget_class, CcListRow, subtitle); + gtk_widget_class_bind_template_child (widget_class, CcListRow, secondary_label); + gtk_widget_class_bind_template_child (widget_class, CcListRow, icon); + gtk_widget_class_bind_template_child (widget_class, CcListRow, enable_switch); + + gtk_widget_class_bind_template_callback (widget_class, cc_list_row_switch_active_cb); +} + +static void +cc_list_row_init (CcListRow *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); + g_signal_connect_object (self, "notify::parent", + G_CALLBACK (cc_list_row_parent_changed_cb), + self, G_CONNECT_SWAPPED); +} + +void +cc_list_row_set_icon_name (CcListRow *self, + const gchar *icon_name) +{ + g_return_if_fail (CC_IS_LIST_ROW (self)); + g_return_if_fail (!self->show_switch); + + if (icon_name) + g_object_set (self->icon, "icon-name", icon_name, NULL); + + gtk_widget_set_visible (GTK_WIDGET (self->icon), icon_name != NULL); +} + +void +cc_list_row_set_show_switch (CcListRow *self, + gboolean show_switch) +{ + g_return_if_fail (CC_IS_LIST_ROW (self)); + + self->show_switch = !!show_switch; + + gtk_widget_set_visible (GTK_WIDGET (self->enable_switch), self->show_switch); + gtk_widget_set_visible (GTK_WIDGET (self->icon), !self->show_switch); + gtk_widget_set_visible (GTK_WIDGET (self->secondary_label), !self->show_switch); +} + +gboolean +cc_list_row_get_active (CcListRow *self) +{ + g_return_val_if_fail (CC_IS_LIST_ROW (self), FALSE); + g_return_val_if_fail (self->show_switch, FALSE); + + return self->switch_active; +} + +void +cc_list_row_activate (CcListRow *self) +{ + g_return_if_fail (CC_IS_LIST_ROW (self)); + g_return_if_fail (self->show_switch); + + self->switch_active = !self->switch_active; + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIVE]); + + gtk_widget_activate (GTK_WIDGET (self->enable_switch)); +} + +void +cc_list_row_set_secondary_label (CcListRow *self, + const gchar *label) +{ + g_return_if_fail (CC_IS_LIST_ROW (self)); + g_return_if_fail (!self->show_switch); + + if (!label) + label = ""; + + if (g_str_equal (label, gtk_label_get_label (self->secondary_label))) + return; + + gtk_label_set_text (self->secondary_label, label); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SECONDARY_LABEL]); +} + +void +cc_list_row_set_secondary_markup (CcListRow *self, + const gchar *markup) +{ + g_return_if_fail (CC_IS_LIST_ROW (self)); + g_return_if_fail (!self->show_switch); + + if (!markup) + markup = ""; + + if (g_str_equal (markup, gtk_label_get_label (self->secondary_label))) + return; + + gtk_label_set_markup (self->secondary_label, markup); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SECONDARY_LABEL]); +} diff --git a/panels/common/cc-list-row.h b/panels/common/cc-list-row.h new file mode 100644 index 0000000000000000000000000000000000000000..43997fa7afce4cb033a069012ebc0944009b0a3f --- /dev/null +++ b/panels/common/cc-list-row.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* cc-list-row.h + * + * Copyright 2019 Purism SPC + * + * 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 . + * + * Author(s): + * Mohammed Sadiq + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define CC_TYPE_LIST_ROW (cc_list_row_get_type()) +G_DECLARE_FINAL_TYPE (CcListRow, cc_list_row, CC, LIST_ROW, GtkListBoxRow) + +void cc_list_row_set_icon_name (CcListRow *self, + const gchar *icon_name); +void cc_list_row_set_show_switch (CcListRow *self, + gboolean show_switch); +gboolean cc_list_row_get_active (CcListRow *self); +void cc_list_row_activate (CcListRow *self); +void cc_list_row_set_secondary_label (CcListRow *self, + const gchar *label); +void cc_list_row_set_secondary_markup (CcListRow *self, + const gchar *markup); + +G_END_DECLS diff --git a/panels/common/cc-list-row.ui b/panels/common/cc-list-row.ui new file mode 100644 index 0000000000000000000000000000000000000000..730b8d91a69e9e478413cbfc273e818ee8fd1fd2 --- /dev/null +++ b/panels/common/cc-list-row.ui @@ -0,0 +1,84 @@ + + + + diff --git a/panels/common/common.gresource.xml b/panels/common/common.gresource.xml index 30e700f58bab1cefe00a60dfd74d7844d8334e3c..e02a835f080387ca145eaa9066738a908d4825e1 100644 --- a/panels/common/common.gresource.xml +++ b/panels/common/common.gresource.xml @@ -2,5 +2,6 @@ cc-language-chooser.ui + cc-list-row.ui diff --git a/panels/common/meson.build b/panels/common/meson.build index a528c567b9fe703d060bc26a3df6f3d941924608..e0c74d30546a5d7d7ea0386cfb535487a398b4a5 100644 --- a/panels/common/meson.build +++ b/panels/common/meson.build @@ -45,10 +45,14 @@ libwidgets_dep = declare_dependency( sources = common_sources + files( 'cc-common-language.c', 'cc-language-chooser.c', + 'cc-list-row.c', 'cc-util.c' ) -resource_data = files('cc-language-chooser.ui') +resource_data = files( + 'cc-language-chooser.ui', + 'cc-list-row.ui', +) sources += gnome.compile_resources( 'cc-common-resources', diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c index 65b7d21f10a1bd5ec0bf7fcfc9a5a64c0ca3b615..e304c4123d289574c1dc086672928f727205b946 100644 --- a/panels/info-overview/cc-info-overview-panel.c +++ b/panels/info-overview/cc-info-overview-panel.c @@ -1,5 +1,6 @@ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- * + * Copyright (C) 2019 Purism SPC * Copyright (C) 2017 Mohammed Sadiq * Copyright (C) 2010 Red Hat, Inc * Copyright (C) 2008 William Jon McCann @@ -48,30 +49,29 @@ #include #endif +#include "cc-list-row.h" +#include "list-box-helper.h" #include "cc-info-overview-panel.h" - -typedef struct -{ - GtkLabel *disk_label; - GtkLabel *graphics_label; - GtkLabel *memory_label; - GtkLabel *name_entry; - GtkLabel *os_name_label; - GtkLabel *os_type_label; - GtkLabel *processor_label; - GtkButton *updates_button; - GtkLabel *version_label; - GtkLabel *virt_type_label; - GtkLabel *virt_type_title_label; -} CcInfoOverviewPanelPrivate; - struct _CcInfoOverviewPanel { - CcPanel parent_instance; - - /*< private >*/ - CcInfoOverviewPanelPrivate *priv; + CcPanel parent_instance; + + GtkEntry *device_name_entry; + CcListRow *disk_row; + CcListRow *gnome_version_row; + CcListRow *graphics_row; + GtkListBox *hardware_box; + GtkDialog *hostname_editor; + CcHostnameEntry *hostname_entry; + CcListRow *hostname_row; + CcListRow *memory_row; + GtkListBox *os_box; + CcListRow *os_name_row; + CcListRow *os_type_row; + CcListRow *processor_row; + CcListRow *software_updates_row; + CcListRow *virtualization_row; }; typedef struct @@ -97,7 +97,7 @@ version_data_free (VersionData *data) G_DEFINE_AUTOPTR_CLEANUP_FUNC (VersionData, version_data_free); -G_DEFINE_TYPE_WITH_PRIVATE (CcInfoOverviewPanel, cc_info_overview_panel, CC_TYPE_PANEL) +G_DEFINE_TYPE (CcInfoOverviewPanel, cc_info_overview_panel, CC_TYPE_PANEL) static void version_start_element_handler (GMarkupParseContext *ctx, @@ -397,7 +397,6 @@ get_os_type (void) static void get_primary_disc_info (CcInfoOverviewPanel *self) { - CcInfoOverviewPanelPrivate *priv; g_autoptr(UDisksClient) client = NULL; GDBusObjectManager *manager; g_autolist(GDBusObject) objects = NULL; @@ -405,7 +404,6 @@ get_primary_disc_info (CcInfoOverviewPanel *self) guint64 total_size; g_autoptr(GError) error = NULL; - priv = cc_info_overview_panel_get_instance_private (self); total_size = 0; client = udisks_client_new_sync (NULL, &error); @@ -413,7 +411,7 @@ get_primary_disc_info (CcInfoOverviewPanel *self) { g_warning ("Unable to get UDisks client: %s. Disk information will not be available.", error->message); - gtk_label_set_text (priv->disk_label, _("Unknown")); + cc_list_row_set_secondary_label (self->disk_row, _("Unknown")); return; } @@ -439,11 +437,11 @@ get_primary_disc_info (CcInfoOverviewPanel *self) if (total_size > 0) { g_autofree gchar *size = g_format_size (total_size); - gtk_label_set_text (priv->disk_label, size); + cc_list_row_set_secondary_label (self->disk_row, size); } else { - gtk_label_set_text (priv->disk_label, _("Unknown")); + cc_list_row_set_secondary_label (self->disk_row, _("Unknown")); } } @@ -525,15 +523,15 @@ set_virtualization_label (CcInfoOverviewPanel *self, const char *virt) { const char *display_name; - CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self); guint i; if (virt == NULL || *virt == '\0') - { - gtk_widget_hide (GTK_WIDGET (priv->virt_type_label)); - gtk_widget_hide (GTK_WIDGET (priv->virt_type_title_label)); - return; - } + { + gtk_widget_hide (GTK_WIDGET (self->virtualization_row)); + return; + } + + gtk_widget_show (GTK_WIDGET (self->virtualization_row)); display_name = NULL; for (i = 0; i < G_N_ELEMENTS (virt_tech); i++) @@ -545,7 +543,7 @@ set_virtualization_label (CcInfoOverviewPanel *self, } } - gtk_label_set_text (priv->virt_type_label, display_name ? display_name : virt); + cc_list_row_set_secondary_label (self->virtualization_row, display_name ? display_name : virt); } static void @@ -601,34 +599,29 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self) g_autofree char *os_type_text = NULL; g_autofree char *os_name_text = NULL; g_autofree gchar *graphics_hardware_string = NULL; - CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self); if (load_gnome_version (&gnome_version, NULL, NULL)) - { - g_autofree gchar *text = NULL; - text = g_strdup_printf (_("Version %s"), gnome_version); - gtk_label_set_text (priv->version_label, text); - } + cc_list_row_set_secondary_label (self->gnome_version_row, gnome_version); glibtop_get_mem (&mem); memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS); - gtk_label_set_text (priv->memory_label, memory_text ? memory_text : ""); + cc_list_row_set_secondary_label (self->memory_row, memory_text); info = glibtop_get_sysinfo (); cpu_text = get_cpu_info (info); - gtk_label_set_markup (priv->processor_label, cpu_text ? cpu_text : ""); + cc_list_row_set_secondary_markup (self->processor_row, cpu_text); os_type_text = get_os_type (); - gtk_label_set_text (priv->os_type_label, os_type_text ? os_type_text : ""); + cc_list_row_set_secondary_label (self->os_type_row, os_type_text); os_name_text = get_os_name (); - gtk_label_set_text (priv->os_name_label, os_name_text ? os_name_text : ""); + cc_list_row_set_secondary_label (self->os_name_row, os_name_text); get_primary_disc_info (self); graphics_hardware_string = get_graphics_hardware_string (); - gtk_label_set_markup (priv->graphics_label, graphics_hardware_string); + cc_list_row_set_secondary_markup (self->graphics_row, graphics_hardware_string); } static gboolean @@ -644,7 +637,7 @@ does_gpk_update_viewer_exist (void) } static void -on_updates_button_clicked (CcInfoOverviewPanel *self) +open_software_update (CcInfoOverviewPanel *self) { g_autoptr(GError) error = NULL; gboolean ret; @@ -665,6 +658,50 @@ on_updates_button_clicked (CcInfoOverviewPanel *self) g_warning ("Failed to spawn %s: %s", argv[0], error->message); } +static void +open_hostname_edit_dialog (CcInfoOverviewPanel *self) +{ + GtkWindow *toplevel; + CcShell *shell; + const gchar *hostname; + gint response; + + g_assert (CC_IS_INFO_OVERVIEW_PANEL (self)); + + shell = cc_panel_get_shell (CC_PANEL (self)); + toplevel = GTK_WINDOW (cc_shell_get_toplevel (shell)); + gtk_window_set_transient_for (GTK_WINDOW (self->hostname_editor), toplevel); + + hostname = gtk_entry_get_text (GTK_ENTRY (self->hostname_entry)); + gtk_entry_set_text (self->device_name_entry, hostname); + gtk_widget_grab_focus (GTK_WIDGET (self->device_name_entry)); + + response = gtk_dialog_run (self->hostname_editor); + gtk_widget_hide (GTK_WIDGET (self->hostname_editor)); + + if (response != GTK_RESPONSE_APPLY) + return; + + /* We simply change the CcHostnameEntry text. CcHostnameEntry + * listens to changes and updates hostname on change. + */ + hostname = gtk_entry_get_text (self->device_name_entry); + gtk_entry_set_text (GTK_ENTRY (self->hostname_entry), hostname); +} + +static void +cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self, + CcListRow *row) +{ + g_assert (CC_IS_INFO_OVERVIEW_PANEL (self)); + g_assert (CC_IS_LIST_ROW (row)); + + if (row == self->hostname_row) + open_hostname_edit_dialog (self); + else if (row == self->software_updates_row) + open_software_update (self); +} + static void cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass) { @@ -672,34 +709,39 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info-overview/cc-info-overview-panel.ui"); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, disk_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, graphics_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, memory_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, name_entry); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, os_name_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, os_type_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, processor_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, updates_button); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, version_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, virt_type_label); - gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, virt_type_title_label); - - gtk_widget_class_bind_template_callback (widget_class, on_updates_button_clicked); - + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, device_name_entry); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, disk_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, gnome_version_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, graphics_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hardware_box); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_editor); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_entry); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, memory_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, os_box); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, os_name_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, os_type_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, processor_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, software_updates_row); + gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, virtualization_row); + + gtk_widget_class_bind_template_callback (widget_class, cc_info_panel_row_activated_cb); + + g_type_ensure (CC_TYPE_LIST_ROW); g_type_ensure (CC_TYPE_HOSTNAME_ENTRY); } static void cc_info_overview_panel_init (CcInfoOverviewPanel *self) { - CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self); - gtk_widget_init_template (GTK_WIDGET (self)); + gtk_list_box_set_header_func (self->hardware_box, cc_list_box_update_header_func, NULL, NULL); + gtk_list_box_set_header_func (self->os_box, cc_list_box_update_header_func, NULL, NULL); g_resources_register (cc_info_overview_get_resource ()); if (!does_gnome_software_exist () && !does_gpk_update_viewer_exist ()) - gtk_widget_destroy (GTK_WIDGET (priv->updates_button)); + gtk_widget_hide (GTK_WIDGET (self->software_updates_row)); info_overview_panel_setup_overview (self); info_overview_panel_setup_virt (self); diff --git a/panels/info-overview/cc-info-overview-panel.ui b/panels/info-overview/cc-info-overview-panel.ui index 7e8992766d425d7eed1af2bf9ff962d52271d99d..691611f4ba1c81db8f52a84db2027f7bc8a9a840 100644 --- a/panels/info-overview/cc-info-overview-panel.ui +++ b/panels/info-overview/cc-info-overview-panel.ui @@ -8,6 +8,7 @@ True False + 480 never @@ -23,8 +24,7 @@ True False center - center - 18 + 30 vertical @@ -35,322 +35,138 @@ False False - 0 + - + True - False - Version 3.0 - True - - - - - - False - False - 1 - - - - - True - center - center - False - 12 - 5 - - - True - False - 1 - Device name - name_entry - - - - 0 - 1 - - - - - True - False - 1 - Memory - memory_label - - - - 1 - 1 - - - - - True - False - 1 - Processor - processor_label - - - - 2 - 1 - - + none + + + + - + True - False - 1 - Graphics - + Device Name + + go-next-symbolic - - 3 - 1 - - - - - True - False - 1 - OS name - os_name_label - - - - 4 - 1 - - - - - True - False - 1 - OS type - os_type_label - - - - 5 - 1 - - - - - True - False - 1 - Virtualization - virt_type_label - - - - 6 - 1 - - - - - True - False - 1 - Disk - disk_label - - - - 7 - 1 - - - - - True - 0 - - - 0 - 2 - 2 - + + + + + + + True + none + + + - + True - False - end - 0 - Unknown - True + False + Memory - - 1 - 2 - + + - + True - False - end - 0 - Unknown - True + False + Processor - - 2 - 2 - + + - + True - False - end - 0 - Unknown - True + False + Graphics - - 3 - 2 - + + - + True - False - end - 0 - Unknown - True + False + Disk Capacity + Calculating… - - 4 - 2 - + + + + + + + True + none + + + + - + True - False - end - 0 - Unknown - True + False + OS Name - - 5 - 2 - + + - + True - False - end - 0 - Unknown - True + False + OS Type - - 6 - 2 - + + - + True - False - end - 0 - Calculating… - True + False + GNOME Version + 3.0 - - 7 - 2 - + + - - True - False - + + False + Virtualization + False - - 1 - 3 - - - - - - - - False - False - 2 - - - - - True - False - end - horizontal - - + + - - Check for updates - True - True - False + True - + Software Updates + go-next-symbolic - - False - True - 1 - + - - False - False - end - 3 - + @@ -358,4 +174,67 @@ + + + False + True + 1 + 24 + Rename Device + + + + + 0 + 18 + 12 + 12 + 18 + + + True + 18 + True + 35 + 0.0 + The device name is used to identify this device when it is viewed over the network, or when pairing Bluetooth devices. + + + + + True + + + + + + + + + True + True + True + _Rename + + + + + + + True + True + _Cancel + + + + + rename_button + cancel_button + + + + + 0 + +