import gnome-control-center-3.28.2-26.el8

This commit is contained in:
CentOS Sources 2021-03-30 08:07:48 -04:00 committed by Stepan Oksanichenko
parent 078e3cfdbe
commit 13121ddf85
7 changed files with 4094 additions and 19 deletions

View File

@ -1,7 +1,7 @@
From 0ce01af0e0e58d81f998093f5a8a068539f56c12 Mon Sep 17 00:00:00 2001 From 3283b063af3f97cfc414766a42de80fc5ee43ba4 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com> From: Kalev Lember <klember@redhat.com>
Date: Fri, 28 Jun 2019 17:14:36 +0200 Date: Fri, 28 Jun 2019 17:14:36 +0200
Subject: [PATCH] info: Add subscription manager integration Subject: [PATCH 1/4] info: Add subscription manager integration
--- ---
panels/info/cc-info-overview-panel.c | 157 ++++- panels/info/cc-info-overview-panel.c | 157 ++++-
@ -27,7 +27,30 @@ diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview
index 2256b730c..1467060f9 100644 index 2256b730c..1467060f9 100644
--- a/panels/info/cc-info-overview-panel.c --- a/panels/info/cc-info-overview-panel.c
+++ b/panels/info/cc-info-overview-panel.c +++ b/panels/info/cc-info-overview-panel.c
@@ -24,6 +24,8 @@ @@ -1,118 +1,126 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2017 Mohammed Sadiq <sadiq@sadiqpk.org>
* Copyright (C) 2010 Red Hat, Inc
* Copyright (C) 2008 William Jon McCann <jmccann@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 2 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/>.
*
*/
#include <config.h>
#include "shell/cc-hostname-entry.h" #include "shell/cc-hostname-entry.h"
#include "cc-info-resources.h" #include "cc-info-resources.h"
@ -36,7 +59,44 @@ index 2256b730c..1467060f9 100644
#include "info-cleanup.h" #include "info-cleanup.h"
#include <glib.h> #include <glib.h>
@@ -68,6 +70,10 @@ typedef struct #include <glib/gi18n.h>
#include <gio/gio.h>
#include <gio/gunixmounts.h>
#include <gio/gdesktopappinfo.h>
#include <glibtop/fsusage.h>
#include <glibtop/mountlist.h>
#include <glibtop/mem.h>
#include <glibtop/sysinfo.h>
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "gsd-disk-space-helper.h"
#include "cc-info-overview-panel.h"
typedef struct {
/* Will be one or 2 GPU name strings, or "Unknown" */
char *hardware_string;
} GraphicsData;
typedef struct
{
GtkWidget *system_image;
GtkWidget *version_label;
GtkWidget *name_entry;
GtkWidget *memory_label;
GtkWidget *processor_label;
GtkWidget *os_name_label;
GtkWidget *os_type_label;
GtkWidget *disk_label; GtkWidget *disk_label;
GtkWidget *graphics_label; GtkWidget *graphics_label;
GtkWidget *virt_type_label; GtkWidget *virt_type_label;
@ -47,7 +107,18 @@ index 2256b730c..1467060f9 100644
GtkWidget *updates_button; GtkWidget *updates_button;
/* Virtualisation labels */ /* Virtualisation labels */
@@ -86,6 +92,8 @@ typedef struct GtkWidget *label8;
GtkWidget *grid1;
GtkWidget *label18;
char *gnome_version;
char *gnome_distributor;
char *gnome_date;
GCancellable *cancellable;
/* Free space */
GList *primary_mounts;
guint64 total_bytes; guint64 total_bytes;
GraphicsData *graphics_data; GraphicsData *graphics_data;
@ -56,7 +127,61 @@ index 2256b730c..1467060f9 100644
} CcInfoOverviewPanelPrivate; } CcInfoOverviewPanelPrivate;
struct _CcInfoOverviewPanel struct _CcInfoOverviewPanel
@@ -586,7 +594,6 @@ get_primary_disc_info (CcInfoOverviewPanel *self) {
CcPanel parent_instance;
/*< private >*/
CcInfoOverviewPanelPrivate *priv;
};
static void get_primary_disc_info_start (CcInfoOverviewPanel *self);
typedef struct
{
char *major;
char *minor;
char *micro;
char *distributor;
char *date;
char **current;
} VersionData;
static void
version_data_free (VersionData *data)
{
g_free (data->major);
g_free (data->minor);
g_free (data->micro);
g_free (data->distributor);
g_free (data->date);
@@ -559,61 +567,60 @@ get_primary_disc_info (CcInfoOverviewPanel *self)
points = g_unix_mounts_get (NULL);
for (p = points; p != NULL; p = p->next)
{
GUnixMountEntry *mount = p->data;
const char *mount_path;
const char *device_path;
mount_path = g_unix_mount_get_mount_path (mount);
device_path = g_unix_mount_get_device_path (mount);
/* Do not count multiple mounts with same device_path, because it is
* probably something like btrfs subvolume. Use only the first one in
* order to count the real size. */
if (gsd_should_ignore_unix_mount (mount) ||
gsd_is_removable_mount (mount) ||
g_str_has_prefix (mount_path, "/media/") ||
g_str_has_prefix (mount_path, g_get_home_dir ()) ||
g_hash_table_lookup (hash, device_path) != NULL)
{
g_unix_mount_free (mount);
continue;
}
priv->primary_mounts = g_list_prepend (priv->primary_mounts, mount);
g_hash_table_insert (hash, (gpointer) device_path, (gpointer) device_path);
}
g_list_free (points); g_list_free (points);
g_hash_table_destroy (hash); g_hash_table_destroy (hash);
@ -64,7 +189,61 @@ index 2256b730c..1467060f9 100644
get_primary_disc_info_start (self); get_primary_disc_info_start (self);
} }
@@ -793,6 +800,137 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self) static char *
get_cpu_info (const glibtop_sysinfo *info)
{
g_autoptr(GHashTable) counts = NULL;
g_autoptr(GString) cpu = NULL;
GHashTableIter iter;
gpointer key, value;
int i;
int j;
counts = g_hash_table_new (g_str_hash, g_str_equal);
/* count duplicates */
for (i = 0; i != info->ncpu; ++i)
{
const char * const keys[] = { "model name", "cpu", "Processor" };
char *model;
int *count;
model = NULL;
for (j = 0; model == NULL && j != G_N_ELEMENTS (keys); ++j)
{
model = g_hash_table_lookup (info->cpuinfo[i].values,
keys[j]);
}
@@ -766,60 +773,191 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
res = load_gnome_version (&priv->gnome_version,
&priv->gnome_distributor,
&priv->gnome_date);
if (res)
{
g_autofree gchar *text = NULL;
text = g_strdup_printf (_("Version %s"), priv->gnome_version);
gtk_label_set_text (GTK_LABEL (priv->version_label), text);
}
glibtop_get_mem (&mem);
memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS);
gtk_label_set_text (GTK_LABEL (priv->memory_label), memory_text ? memory_text : "");
info = glibtop_get_sysinfo ();
cpu_text = get_cpu_info (info);
gtk_label_set_markup (GTK_LABEL (priv->processor_label), cpu_text ? cpu_text : "");
os_type_text = get_os_type ();
gtk_label_set_text (GTK_LABEL (priv->os_type_label), os_type_text ? os_type_text : "");
os_name_text = get_os_name ();
gtk_label_set_text (GTK_LABEL (priv->os_name_label), os_name_text ? os_name_text : "");
get_primary_disc_info (self);
gtk_label_set_markup (GTK_LABEL (priv->graphics_label), priv->graphics_data->hardware_string); gtk_label_set_markup (GTK_LABEL (priv->graphics_label), priv->graphics_data->hardware_string);
} }
@ -202,7 +381,61 @@ index 2256b730c..1467060f9 100644
static gboolean static gboolean
does_gnome_software_exist (void) does_gnome_software_exist (void)
{ {
@@ -856,6 +994,8 @@ cc_info_overview_panel_finalize (GObject *object) return g_file_test (BINDIR "/gnome-software", G_FILE_TEST_EXISTS);
}
static gboolean
does_gpk_update_viewer_exist (void)
{
return g_file_test (BINDIR "/gpk-update-viewer", G_FILE_TEST_EXISTS);
}
static void
on_updates_button_clicked (GtkWidget *widget,
CcInfoOverviewPanel *self)
{
g_autoptr(GError) error = NULL;
gboolean ret;
g_auto(GStrv) argv = NULL;
argv = g_new0 (gchar *, 3);
if (does_gnome_software_exist ())
{
argv[0] = g_build_filename (BINDIR, "gnome-software", NULL);
argv[1] = g_strdup_printf ("--mode=updates");
}
else
{
argv[0] = g_build_filename (BINDIR, "gpk-update-viewer", NULL);
}
@@ -829,88 +967,103 @@ on_updates_button_clicked (GtkWidget *widget,
}
static void
cc_info_overview_panel_dispose (GObject *object)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (CC_INFO_OVERVIEW_PANEL (object));
g_clear_pointer (&priv->graphics_data, graphics_data_free);
G_OBJECT_CLASS (cc_info_overview_panel_parent_class)->dispose (object);
}
static void
cc_info_overview_panel_finalize (GObject *object)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (CC_INFO_OVERVIEW_PANEL (object));
if (priv->cancellable)
{
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
}
if (priv->primary_mounts)
g_list_free_full (priv->primary_mounts, (GDestroyNotify) g_unix_mount_free);
g_free (priv->gnome_version);
g_free (priv->gnome_date); g_free (priv->gnome_date);
g_free (priv->gnome_distributor); g_free (priv->gnome_distributor);
@ -211,7 +444,24 @@ index 2256b730c..1467060f9 100644
G_OBJECT_CLASS (cc_info_overview_panel_parent_class)->finalize (object); G_OBJECT_CLASS (cc_info_overview_panel_parent_class)->finalize (object);
} }
@@ -880,6 +1020,10 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass) static void
cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = cc_info_overview_panel_finalize;
object_class->dispose = cc_info_overview_panel_dispose;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info/info-overview.ui");
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, system_image);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, version_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, name_entry);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, memory_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, processor_label);
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, disk_label); 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, graphics_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_label);
@ -222,7 +472,17 @@ index 2256b730c..1467060f9 100644
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, updates_button); gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, updates_button);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, label8); gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, label8);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, grid1); gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, grid1);
@@ -897,15 +1041,24 @@ cc_info_overview_panel_init (CcInfoOverviewPanel *self) gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, label18);
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));
g_resources_register (cc_info_get_resource ()); g_resources_register (cc_info_get_resource ());
@ -248,6 +508,11 @@ index 2256b730c..1467060f9 100644
} }
GtkWidget * GtkWidget *
cc_info_overview_panel_new (void)
{
return g_object_new (CC_TYPE_INFO_OVERVIEW_PANEL,
NULL);
}
diff --git a/panels/info/cc-subscription-details-dialog.c b/panels/info/cc-subscription-details-dialog.c diff --git a/panels/info/cc-subscription-details-dialog.c b/panels/info/cc-subscription-details-dialog.c
new file mode 100644 new file mode 100644
index 000000000..1931ced81 index 000000000..1931ced81
@ -2033,7 +2298,10 @@ diff --git a/panels/info/info-overview.ui b/panels/info/info-overview.ui
index aa87fbec2..e33ba399a 100644 index aa87fbec2..e33ba399a 100644
--- a/panels/info/info-overview.ui --- a/panels/info/info-overview.ui
+++ b/panels/info/info-overview.ui +++ b/panels/info/info-overview.ui
@@ -4,16 +4,17 @@ @@ -1,46 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<template class="CcInfoOverviewPanel" parent="CcPanel"> <template class="CcInfoOverviewPanel" parent="CcPanel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
@ -2054,7 +2322,61 @@ index aa87fbec2..e33ba399a 100644
<child> <child>
<object class="GtkImage" id="system_image"> <object class="GtkImage" id="system_image">
<property name="visible">True</property> <property name="visible">True</property>
@@ -303,26 +304,143 @@ <property name="can_focus">False</property>
<property name="pixel_size">128</property>
<property name="icon_name">fedora-logo-icon</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="os_name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Version 3.0</property>
<property name="selectable">True</property>
<property name="margin-bottom">24</property>
<attributes>
<attribute name="scale" value="1.25"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -276,64 +277,181 @@
<property name="label" translatable="yes">Calculating…</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="top-attach">7</property>
<property name="left-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dummy1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label"> </property>
</object>
<packing>
<property name="top-attach">1</property>
<property name="left-attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2205,11 +2527,25 @@ index aa87fbec2..e33ba399a 100644
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</template>
</interface>
diff --git a/panels/info/info.gresource.xml b/panels/info/info.gresource.xml diff --git a/panels/info/info.gresource.xml b/panels/info/info.gresource.xml
index c96722350..15d18daac 100644 index c96722350..15d18daac 100644
--- a/panels/info/info.gresource.xml --- a/panels/info/info.gresource.xml
+++ b/panels/info/info.gresource.xml +++ b/panels/info/info.gresource.xml
@@ -4,6 +4,8 @@ @@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/info">
<file preprocess="xml-stripblanks">info-overview.ui</file> <file preprocess="xml-stripblanks">info-overview.ui</file>
<file preprocess="xml-stripblanks">info-default-apps.ui</file> <file preprocess="xml-stripblanks">info-default-apps.ui</file>
<file preprocess="xml-stripblanks">info-removable-media.ui</file> <file preprocess="xml-stripblanks">info-removable-media.ui</file>
@ -2222,7 +2558,34 @@ diff --git a/panels/info/meson.build b/panels/info/meson.build
index 13015b96c..a4ff83a42 100644 index 13015b96c..a4ff83a42 100644
--- a/panels/info/meson.build --- a/panels/info/meson.build
+++ b/panels/info/meson.build +++ b/panels/info/meson.build
@@ -41,11 +41,15 @@ sources = files(gsd_sources) + files( @@ -14,65 +14,69 @@ foreach name: panel_names
output: desktop + '.in',
configuration: desktop_conf
)
i18n.merge_file(
desktop,
type: 'desktop',
input: desktop_in,
output: desktop,
po_dir: po_dir,
install: true,
install_dir: control_center_desktopdir
)
endforeach
cflags += [
'-DBINDIR="@0@"'.format(control_center_bindir),
'-DDATADIR="@0@"'.format(control_center_datadir),
'-DGNOME_SESSION_DIR="@0@"'.format(gnome_session_libexecdir),
'-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
]
gsd_headers = ['gsd-disk-space-helper.h']
gsd_sources = ['gsd-disk-space-helper.c']
sources = files(gsd_sources) + files(
'cc-info-default-apps-panel.c', 'cc-info-default-apps-panel.c',
'cc-info-overview-panel.c', 'cc-info-overview-panel.c',
'cc-info-removable-media-panel.c', 'cc-info-removable-media-panel.c',
@ -2238,11 +2601,65 @@ index 13015b96c..a4ff83a42 100644
'info-default-apps.ui', 'info-default-apps.ui',
'info-overview.ui', 'info-overview.ui',
'info-removable-media.ui' 'info-removable-media.ui'
)
sources += gnome.compile_resources(
'cc-' + cappletname + '-resources',
cappletname + '.gresource.xml',
c_name: 'cc_' + cappletname,
dependencies: resource_data,
export: true
)
deps = common_deps + [
polkit_gobject_dep,
dependency('libgtop-2.0')
]
panels_libs += static_library(
cappletname,
sources: sources,
include_directories: top_inc,
dependencies: deps,
c_args: cflags
)
test_name = 'test-info-cleanup'
sources = files(
'info-cleanup.c',
diff --git a/po/POTFILES.in b/po/POTFILES.in diff --git a/po/POTFILES.in b/po/POTFILES.in
index dfd8ccff0..6cb8938e9 100644 index dfd8ccff0..6cb8938e9 100644
--- a/po/POTFILES.in --- a/po/POTFILES.in
+++ b/po/POTFILES.in +++ b/po/POTFILES.in
@@ -34,6 +34,10 @@ panels/display/display.ui @@ -7,60 +7,64 @@ panels/background/cc-background-item.c
panels/background/cc-background-panel.c
panels/background/gnome-background-panel.desktop.in.in
panels/bluetooth/bluetooth.ui
panels/bluetooth/cc-bluetooth-panel.c
panels/bluetooth/gnome-bluetooth-panel.desktop.in.in
panels/color/cc-color-calibrate.c
panels/color/cc-color-common.c
panels/color/cc-color-device.c
panels/color/cc-color-panel.c
panels/color/cc-color-profile.c
panels/color/color-calibrate.ui
panels/color/color.ui
panels/color/gnome-color-panel.desktop.in.in
panels/common/cc-common-language.c
panels/common/cc-language-chooser.c
panels/common/cc-util.c
panels/common/language-chooser.ui
panels/datetime/big.ui
panels/datetime/cc-datetime-panel.c
panels/datetime/datetime.ui
panels/datetime/gnome-datetime-panel.desktop.in.in
panels/datetime/little.ui
panels/datetime/middle.ui
panels/datetime/org.gnome.controlcenter.datetime.policy.in
panels/datetime/ydm.ui
panels/display/cc-display-panel.c
panels/display/display.ui
panels/display/gnome-display-panel.desktop.in.in panels/display/gnome-display-panel.desktop.in.in
panels/info/cc-info-overview-panel.c panels/info/cc-info-overview-panel.c
panels/info/cc-info-removable-media-panel.c panels/info/cc-info-removable-media-panel.c
@ -2253,6 +2670,33 @@ index dfd8ccff0..6cb8938e9 100644
panels/info/gnome-default-apps-panel.desktop.in.in panels/info/gnome-default-apps-panel.desktop.in.in
panels/info/gnome-info-overview-panel.desktop.in.in panels/info/gnome-info-overview-panel.desktop.in.in
panels/info/gnome-removable-media-panel.desktop.in.in panels/info/gnome-removable-media-panel.desktop.in.in
panels/info/info-default-apps.ui
panels/info/info-overview.ui
panels/info/info-removable-media.ui
panels/keyboard/00-multimedia.xml.in
panels/keyboard/01-input-sources.xml.in
panels/keyboard/01-launchers.xml.in
panels/keyboard/01-screenshot.xml.in
panels/keyboard/01-system.xml.in
panels/keyboard/50-accessibility.xml.in
panels/keyboard/cc-keyboard-manager.c
panels/keyboard/cc-keyboard-option.c
panels/keyboard/cc-keyboard-panel.c
panels/keyboard/cc-keyboard-shortcut-editor.c
panels/keyboard/gnome-keyboard-panel.desktop.in.in
panels/keyboard/gnome-keyboard-panel.ui
panels/keyboard/keyboard-shortcuts.c
panels/keyboard/shortcut-editor.ui
panels/mouse/cc-mouse-panel.c
panels/mouse/gnome-mouse-panel.desktop.in.in
panels/mouse/gnome-mouse-properties.c
panels/mouse/gnome-mouse-properties.ui
panels/mouse/gnome-mouse-test.c
panels/mouse/gnome-mouse-test.ui
panels/network/cc-network-panel.c
panels/network/cc-wifi-panel.c
panels/network/connection-editor/8021x-security-page.ui
panels/network/connection-editor/ce-page-8021x-security.c
-- --
2.21.0 2.28.0

View File

@ -0,0 +1,228 @@
From 2025db03559f4ca8872045618cac75cfb2fe10f1 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 24 Jan 2021 10:29:56 -0500
Subject: [PATCH 2/4] info: Move helper for getting subscription status to
header
In the future we're going to need to be able to get the subscription
status in two files, so move the function for getting that status
to a common header.
Ideally we'd be using code generation for the subscription proxy
instead, but that's a bigger refactor that will have to wait for
another day.
---
panels/info/cc-info-overview-panel.c | 32 ++------------------------
panels/info/cc-subscription-common.h | 34 ++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 30 deletions(-)
create mode 100644 panels/info/cc-subscription-common.h
diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c
index 1467060f9..b2cbefb25 100644
--- a/panels/info/cc-info-overview-panel.c
+++ b/panels/info/cc-info-overview-panel.c
@@ -1,56 +1,57 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2017 Mohammed Sadiq <sadiq@sadiqpk.org>
* Copyright (C) 2010 Red Hat, Inc
* Copyright (C) 2008 William Jon McCann <jmccann@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 2 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/>.
*
*/
#include <config.h>
#include "shell/cc-hostname-entry.h"
#include "cc-info-resources.h"
+#include "cc-subscription-common.h"
#include "cc-subscription-details-dialog.h"
#include "cc-subscription-register-dialog.h"
#include "info-cleanup.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gio/gunixmounts.h>
#include <gio/gdesktopappinfo.h>
#include <glibtop/fsusage.h>
#include <glibtop/mountlist.h>
#include <glibtop/mem.h>
#include <glibtop/sysinfo.h>
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "gsd-disk-space-helper.h"
#include "cc-info-overview-panel.h"
typedef struct {
@@ -773,102 +774,73 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
res = load_gnome_version (&priv->gnome_version,
&priv->gnome_distributor,
&priv->gnome_date);
if (res)
{
g_autofree gchar *text = NULL;
text = g_strdup_printf (_("Version %s"), priv->gnome_version);
gtk_label_set_text (GTK_LABEL (priv->version_label), text);
}
glibtop_get_mem (&mem);
memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS);
gtk_label_set_text (GTK_LABEL (priv->memory_label), memory_text ? memory_text : "");
info = glibtop_get_sysinfo ();
cpu_text = get_cpu_info (info);
gtk_label_set_markup (GTK_LABEL (priv->processor_label), cpu_text ? cpu_text : "");
os_type_text = get_os_type ();
gtk_label_set_text (GTK_LABEL (priv->os_type_label), os_type_text ? os_type_text : "");
os_name_text = get_os_name ();
gtk_label_set_text (GTK_LABEL (priv->os_name_label), os_name_text ? os_name_text : "");
get_primary_disc_info (self);
gtk_label_set_markup (GTK_LABEL (priv->graphics_label), priv->graphics_data->hardware_string);
}
-typedef enum {
- GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN,
- GSD_SUBMAN_SUBSCRIPTION_STATUS_VALID,
- GSD_SUBMAN_SUBSCRIPTION_STATUS_INVALID,
- GSD_SUBMAN_SUBSCRIPTION_STATUS_DISABLED,
- GSD_SUBMAN_SUBSCRIPTION_STATUS_PARTIALLY_VALID,
- GSD_SUBMAN_SUBSCRIPTION_STATUS_LAST
-} GsdSubmanSubscriptionStatus;
-
-static gboolean
-get_subscription_status (CcInfoOverviewPanel *self, GsdSubmanSubscriptionStatus *status)
-{
- CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
- g_autoptr(GVariant) status_variant = NULL;
- guint32 u;
-
- status_variant = g_dbus_proxy_get_cached_property (priv->subscription_proxy, "SubscriptionStatus");
- if (!status_variant)
- {
- g_debug ("Unable to get SubscriptionStatus property");
- return FALSE;
- }
-
- g_variant_get (status_variant, "u", &u);
- *status = u;
-
- return TRUE;
-}
-
static void
reload_subscription_status (CcInfoOverviewPanel *self)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
GsdSubmanSubscriptionStatus status;
if (priv->subscription_proxy == NULL)
{
gtk_widget_hide (priv->subscription_stack);
return;
}
- if (!get_subscription_status (self, &status))
+ if (!get_subscription_status (priv->subscription_proxy, &status))
{
gtk_widget_hide (priv->subscription_stack);
return;
}
switch (status)
{
case GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_INVALID:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_DISABLED:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_PARTIALLY_VALID:
gtk_stack_set_visible_child_name (GTK_STACK (priv->subscription_stack), "not-registered");
gtk_widget_set_sensitive (priv->updates_button, FALSE);
break;
case GSD_SUBMAN_SUBSCRIPTION_STATUS_VALID:
gtk_stack_set_visible_child_name (GTK_STACK (priv->subscription_stack), "registered");
gtk_widget_set_sensitive (priv->updates_button, TRUE);
break;
default:
g_assert_not_reached ();
break;
}
}
static void
on_details_button_clicked (GtkWidget *widget,
CcInfoOverviewPanel *self)
{
diff --git a/panels/info/cc-subscription-common.h b/panels/info/cc-subscription-common.h
new file mode 100644
index 000000000..034d64181
--- /dev/null
+++ b/panels/info/cc-subscription-common.h
@@ -0,0 +1,34 @@
+#ifndef CC_SUBSCRIPTION_COMMON_H
+#define CC_SUBSCRIPTION_COMMON_H
+
+typedef enum {
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_VALID,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_INVALID,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_DISABLED,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_PARTIALLY_VALID,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_NO_INSTALLED_PRODUCTS,
+ GSD_SUBMAN_SUBSCRIPTION_STATUS_LAST
+} GsdSubmanSubscriptionStatus;
+
+static inline gboolean
+get_subscription_status (GDBusProxy *subscription_proxy,
+ GsdSubmanSubscriptionStatus *status)
+{
+ g_autoptr(GVariant) status_variant = NULL;
+ guint32 u;
+
+ status_variant = g_dbus_proxy_get_cached_property (subscription_proxy, "SubscriptionStatus");
+ if (!status_variant)
+ {
+ g_debug ("Unable to get SubscriptionStatus property");
+ return FALSE;
+ }
+
+ g_variant_get (status_variant, "u", &u);
+ *status = u;
+
+ return TRUE;
+}
+
+#endif
--
2.28.0

View File

@ -0,0 +1,654 @@
From 8bd1e37f59f3b4ec617d6d0bccf7fd77a9d03ca5 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 24 Jan 2021 13:03:03 -0500
Subject: [PATCH 3/4] info: Update registration state in panel when it happens
on disk
The code was failing to listen for change notifications, so if the
panel was open while the system got registered, it wouldn't update.
This commit fixes that.
---
panels/info/cc-info-overview-panel.c | 33 ++++++++++++++++---
panels/info/cc-subscription-details-dialog.c | 17 ++++++++--
panels/info/cc-subscription-details-dialog.h | 3 +-
panels/info/cc-subscription-register-dialog.c | 17 ++++++++--
panels/info/cc-subscription-register-dialog.h | 3 +-
5 files changed, 63 insertions(+), 10 deletions(-)
diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c
index b2cbefb25..65246758e 100644
--- a/panels/info/cc-info-overview-panel.c
+++ b/panels/info/cc-info-overview-panel.c
@@ -60,60 +60,61 @@ typedef struct {
} GraphicsData;
typedef struct
{
GtkWidget *system_image;
GtkWidget *version_label;
GtkWidget *name_entry;
GtkWidget *memory_label;
GtkWidget *processor_label;
GtkWidget *os_name_label;
GtkWidget *os_type_label;
GtkWidget *disk_label;
GtkWidget *graphics_label;
GtkWidget *virt_type_label;
GtkWidget *subscription_stack;
GtkWidget *details_button;
GtkWidget *register_button;
GtkWidget *updates_separator;
GtkWidget *updates_button;
/* Virtualisation labels */
GtkWidget *label8;
GtkWidget *grid1;
GtkWidget *label18;
char *gnome_version;
char *gnome_distributor;
char *gnome_date;
GCancellable *cancellable;
+ GCancellable *subscription_cancellable;
/* Free space */
GList *primary_mounts;
guint64 total_bytes;
GraphicsData *graphics_data;
GDBusProxy *subscription_proxy;
} CcInfoOverviewPanelPrivate;
struct _CcInfoOverviewPanel
{
CcPanel parent_instance;
/*< private >*/
CcInfoOverviewPanelPrivate *priv;
};
static void get_primary_disc_info_start (CcInfoOverviewPanel *self);
typedef struct
{
char *major;
char *minor;
char *micro;
char *distributor;
char *date;
char **current;
} VersionData;
@@ -821,165 +822,188 @@ reload_subscription_status (CcInfoOverviewPanel *self)
switch (status)
{
case GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_INVALID:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_DISABLED:
case GSD_SUBMAN_SUBSCRIPTION_STATUS_PARTIALLY_VALID:
gtk_stack_set_visible_child_name (GTK_STACK (priv->subscription_stack), "not-registered");
gtk_widget_set_sensitive (priv->updates_button, FALSE);
break;
case GSD_SUBMAN_SUBSCRIPTION_STATUS_VALID:
gtk_stack_set_visible_child_name (GTK_STACK (priv->subscription_stack), "registered");
gtk_widget_set_sensitive (priv->updates_button, TRUE);
break;
default:
g_assert_not_reached ();
break;
}
}
static void
on_details_button_clicked (GtkWidget *widget,
CcInfoOverviewPanel *self)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
CcSubscriptionDetailsDialog *dialog;
GtkWindow *toplevel;
- dialog = cc_subscription_details_dialog_new (priv->subscription_proxy);
+ dialog = cc_subscription_details_dialog_new (priv->subscription_proxy,
+ priv->subscription_cancellable);
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
gtk_window_set_transient_for (GTK_WINDOW (dialog), toplevel);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
-
- reload_subscription_status (self);
}
static void
on_register_button_clicked (GtkWidget *widget,
CcInfoOverviewPanel *self)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
CcSubscriptionRegisterDialog *dialog;
GtkWindow *toplevel;
- dialog = cc_subscription_register_dialog_new (priv->subscription_proxy);
+ dialog = cc_subscription_register_dialog_new (priv->subscription_proxy,
+ priv->subscription_cancellable);
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
gtk_window_set_transient_for (GTK_WINDOW (dialog), toplevel);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+on_subscription_status_changed (GDBusProxy *proxy,
+ GVariant *changed_properties,
+ GStrv invalidated_properties,
+ CcInfoOverviewPanel *self)
+{
+ CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
+
+ g_cancellable_cancel (priv->subscription_cancellable);
+ g_object_unref (priv->subscription_cancellable);
+
+ priv->subscription_cancellable = g_cancellable_new ();
reload_subscription_status (self);
}
static void
info_overview_panel_setup_subscriptions (CcInfoOverviewPanel *self)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
g_autoptr(GError) error = NULL;
priv->subscription_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.gnome.SettingsDaemon.Subscription",
"/org/gnome/SettingsDaemon/Subscription",
"org.gnome.SettingsDaemon.Subscription",
NULL, &error);
if (error != NULL)
{
g_debug ("Unable to create a proxy for org.gnome.SettingsDaemon.Subscription: %s",
error->message);
reload_subscription_status (self);
return;
}
+ g_signal_connect (priv->subscription_proxy, "g-properties-changed",
+ G_CALLBACK (on_subscription_status_changed), self);
+
g_signal_connect (priv->details_button, "clicked", G_CALLBACK (on_details_button_clicked), self);
g_signal_connect (priv->register_button, "clicked", G_CALLBACK (on_register_button_clicked), self);
reload_subscription_status (self);
}
static gboolean
does_gnome_software_exist (void)
{
return g_file_test (BINDIR "/gnome-software", G_FILE_TEST_EXISTS);
}
static gboolean
does_gpk_update_viewer_exist (void)
{
return g_file_test (BINDIR "/gpk-update-viewer", G_FILE_TEST_EXISTS);
}
static void
on_updates_button_clicked (GtkWidget *widget,
CcInfoOverviewPanel *self)
{
g_autoptr(GError) error = NULL;
gboolean ret;
g_auto(GStrv) argv = NULL;
argv = g_new0 (gchar *, 3);
if (does_gnome_software_exist ())
{
argv[0] = g_build_filename (BINDIR, "gnome-software", NULL);
argv[1] = g_strdup_printf ("--mode=updates");
}
else
{
argv[0] = g_build_filename (BINDIR, "gpk-update-viewer", NULL);
}
ret = g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, &error);
if (!ret)
g_warning ("Failed to spawn %s: %s", argv[0], error->message);
}
static void
cc_info_overview_panel_dispose (GObject *object)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (CC_INFO_OVERVIEW_PANEL (object));
g_clear_pointer (&priv->graphics_data, graphics_data_free);
G_OBJECT_CLASS (cc_info_overview_panel_parent_class)->dispose (object);
}
static void
cc_info_overview_panel_finalize (GObject *object)
{
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (CC_INFO_OVERVIEW_PANEL (object));
+ if (priv->subscription_cancellable)
+ {
+ g_cancellable_cancel (priv->subscription_cancellable);
+ g_clear_object (&priv->subscription_cancellable);
+ }
+
if (priv->cancellable)
{
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
}
if (priv->primary_mounts)
g_list_free_full (priv->primary_mounts, (GDestroyNotify) g_unix_mount_free);
g_free (priv->gnome_version);
g_free (priv->gnome_date);
g_free (priv->gnome_distributor);
g_clear_object (&priv->subscription_proxy);
G_OBJECT_CLASS (cc_info_overview_panel_parent_class)->finalize (object);
}
static void
cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = cc_info_overview_panel_finalize;
object_class->dispose = cc_info_overview_panel_dispose;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info/info-overview.ui");
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, system_image);
@@ -987,55 +1011,56 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, name_entry);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, memory_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, processor_label);
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, disk_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, graphics_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, virt_type_label);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, subscription_stack);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, details_button);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, register_button);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, updates_separator);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, updates_button);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, label8);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, grid1);
gtk_widget_class_bind_template_child_private (widget_class, CcInfoOverviewPanel, label18);
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));
g_resources_register (cc_info_get_resource ());
priv->cancellable = g_cancellable_new ();
+ priv->subscription_cancellable = g_cancellable_new ();
priv->graphics_data = get_graphics_data ();
if (does_gnome_software_exist () || does_gpk_update_viewer_exist ())
g_signal_connect (priv->updates_button, "clicked", G_CALLBACK (on_updates_button_clicked), self);
else
gtk_widget_hide (priv->updates_button);
info_overview_panel_setup_overview (self);
info_overview_panel_setup_virt (self);
info_overview_panel_setup_subscriptions (self);
/* show separator when both items are visible */
if (gtk_widget_get_visible (priv->subscription_stack) && gtk_widget_get_visible (priv->updates_button))
gtk_widget_show (priv->updates_separator);
else
gtk_widget_hide (priv->updates_separator);
}
GtkWidget *
cc_info_overview_panel_new (void)
{
return g_object_new (CC_TYPE_INFO_OVERVIEW_PANEL,
NULL);
}
diff --git a/panels/info/cc-subscription-details-dialog.c b/panels/info/cc-subscription-details-dialog.c
index 1931ced81..3d77e6c48 100644
--- a/panels/info/cc-subscription-details-dialog.c
+++ b/panels/info/cc-subscription-details-dialog.c
@@ -311,97 +311,110 @@ header_unregister_button_clicked_cb (CcSubscriptionDetailsDialog *self)
self);
}
static void
back_button_clicked_cb (CcSubscriptionDetailsDialog *self)
{
gtk_spinner_stop (self->spinner);
self->state = DIALOG_STATE_SHOW_DETAILS;
dialog_reload (self);
}
static void
unregister_button_clicked_cb (CcSubscriptionDetailsDialog *self)
{
self->state = DIALOG_STATE_UNREGISTER;
dialog_reload (self);
}
static void
dismiss_notification (CcSubscriptionDetailsDialog *self)
{
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
}
static void
cc_subscription_details_dialog_init (CcSubscriptionDetailsDialog *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- self->cancellable = g_cancellable_new ();
self->products = g_ptr_array_new_with_free_func ((GDestroyNotify) product_data_free);
self->state = DIALOG_STATE_SHOW_DETAILS;
}
static void
cc_subscription_details_dialog_dispose (GObject *obj)
{
CcSubscriptionDetailsDialog *self = (CcSubscriptionDetailsDialog *) obj;
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
g_clear_object (&self->subscription_proxy);
G_OBJECT_CLASS (cc_subscription_details_dialog_parent_class)->dispose (obj);
}
static void
cc_subscription_details_dialog_finalize (GObject *obj)
{
CcSubscriptionDetailsDialog *self = (CcSubscriptionDetailsDialog *) obj;
g_clear_pointer (&self->products, g_ptr_array_unref);
G_OBJECT_CLASS (cc_subscription_details_dialog_parent_class)->finalize (obj);
}
static void
cc_subscription_details_dialog_class_init (CcSubscriptionDetailsDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = cc_subscription_details_dialog_dispose;
object_class->finalize = cc_subscription_details_dialog_finalize;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info/cc-subscription-details-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, back_button);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, spinner);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, header_unregister_button);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, notification_revealer);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, error_label);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, stack);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, products_box1);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, products_box2);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionDetailsDialog, unregister_button);
gtk_widget_class_bind_template_callback (widget_class, back_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, header_unregister_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, unregister_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, dismiss_notification);
}
+static void
+on_dialog_cancelled (CcSubscriptionDetailsDialog *self)
+{
+ gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
+}
+
CcSubscriptionDetailsDialog *
-cc_subscription_details_dialog_new (GDBusProxy *subscription_proxy)
+cc_subscription_details_dialog_new (GDBusProxy *subscription_proxy,
+ GCancellable *cancellable)
{
CcSubscriptionDetailsDialog *self;
self = g_object_new (CC_TYPE_SUBSCRIPTION_DETAILS_DIALOG, "use-header-bar", TRUE, NULL);
self->subscription_proxy = g_object_ref (subscription_proxy);
+ self->cancellable = g_object_ref (cancellable);
+
+ g_signal_connect_object (G_OBJECT (self->cancellable),
+ "cancelled",
+ G_CALLBACK (on_dialog_cancelled),
+ self,
+ G_CONNECT_SWAPPED);
load_installed_products (self);
dialog_reload (self);
return self;
}
diff --git a/panels/info/cc-subscription-details-dialog.h b/panels/info/cc-subscription-details-dialog.h
index a61a22838..f14dd157b 100644
--- a/panels/info/cc-subscription-details-dialog.h
+++ b/panels/info/cc-subscription-details-dialog.h
@@ -1,32 +1,33 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright 2019 Red Hat, Inc,
*
* 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 2 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/>.
*
* Written by: Kalev Lember <klember@redhat.com>
*/
#pragma once
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define CC_TYPE_SUBSCRIPTION_DETAILS_DIALOG (cc_subscription_details_dialog_get_type ())
G_DECLARE_FINAL_TYPE (CcSubscriptionDetailsDialog, cc_subscription_details_dialog, CC, SUBSCRIPTION_DETAILS_DIALOG, GtkDialog)
-CcSubscriptionDetailsDialog *cc_subscription_details_dialog_new (GDBusProxy *subscription_proxy);
+CcSubscriptionDetailsDialog *cc_subscription_details_dialog_new (GDBusProxy *subscription_proxy,
+ GCancellable *cancellable);
G_END_DECLS
diff --git a/panels/info/cc-subscription-register-dialog.c b/panels/info/cc-subscription-register-dialog.c
index d7a17cc99..e8c2f581c 100644
--- a/panels/info/cc-subscription-register-dialog.c
+++ b/panels/info/cc-subscription-register-dialog.c
@@ -299,61 +299,60 @@ subscription_register_with_username (CcSubscriptionRegisterDialog *self)
self->cancellable,
registration_done_cb,
self);
}
static void
register_button_clicked_cb (CcSubscriptionRegisterDialog *self)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->register_with_activation_keys_radio)))
subscription_register_with_activation_keys (self);
else
subscription_register_with_username (self);
gtk_spinner_start (self->spinner);
self->state = DIALOG_STATE_REGISTERING;
dialog_reload (self);
}
static void
dismiss_notification (CcSubscriptionRegisterDialog *self)
{
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
}
static void
cc_subscription_register_dialog_init (CcSubscriptionRegisterDialog *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- self->cancellable = g_cancellable_new ();
self->state = DIALOG_STATE_REGISTER;
gtk_entry_set_text (self->url_entry, SERVER_URL);
gtk_widget_grab_focus (GTK_WIDGET (self->login_entry));
dialog_validate (self);
dialog_reload (self);
}
static void
cc_subscription_register_dialog_dispose (GObject *obj)
{
CcSubscriptionRegisterDialog *self = (CcSubscriptionRegisterDialog *) obj;
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
g_clear_object (&self->subscription_proxy);
G_OBJECT_CLASS (cc_subscription_register_dialog_parent_class)->dispose (obj);
}
static void
cc_subscription_register_dialog_finalize (GObject *obj)
{
G_OBJECT_CLASS (cc_subscription_register_dialog_parent_class)->finalize (obj);
}
static void
cc_subscription_register_dialog_class_init (CcSubscriptionRegisterDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -364,40 +363,54 @@ cc_subscription_register_dialog_class_init (CcSubscriptionRegisterDialogClass *k
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/info/cc-subscription-register-dialog.ui");
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, spinner);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, register_button);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, notification_revealer);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, error_label);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, default_url_radio);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, custom_url_radio);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, register_radio);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, register_with_activation_keys_radio);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, stack);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, register_grid);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, register_with_activation_keys_grid);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, url_label);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, url_entry);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, login_entry);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, password_entry);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, activation_keys_entry);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, organization_label);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, organization_entry);
gtk_widget_class_bind_template_child (widget_class, CcSubscriptionRegisterDialog, organization_entry_with_activation_keys);
gtk_widget_class_bind_template_callback (widget_class, dialog_validate);
gtk_widget_class_bind_template_callback (widget_class, register_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, dismiss_notification);
gtk_widget_class_bind_template_callback (widget_class, custom_url_radio_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, register_with_activation_keys_radio_toggled_cb);
}
+static void
+on_dialog_cancelled (CcSubscriptionRegisterDialog *self)
+{
+ gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
+}
+
CcSubscriptionRegisterDialog *
-cc_subscription_register_dialog_new (GDBusProxy *subscription_proxy)
+cc_subscription_register_dialog_new (GDBusProxy *subscription_proxy,
+ GCancellable *cancellable)
{
CcSubscriptionRegisterDialog *self;
self = g_object_new (CC_TYPE_SUBSCRIPTION_REGISTER_DIALOG, "use-header-bar", TRUE, NULL);
self->subscription_proxy = g_object_ref (subscription_proxy);
+ self->cancellable = g_object_ref (cancellable);
+
+ g_signal_connect_object (G_OBJECT (self->cancellable),
+ "cancelled",
+ G_CALLBACK (on_dialog_cancelled),
+ self,
+ G_CONNECT_SWAPPED);
return self;
}
diff --git a/panels/info/cc-subscription-register-dialog.h b/panels/info/cc-subscription-register-dialog.h
index c5918df9f..31c254084 100644
--- a/panels/info/cc-subscription-register-dialog.h
+++ b/panels/info/cc-subscription-register-dialog.h
@@ -1,32 +1,33 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright 2019 Red Hat, Inc,
*
* 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 2 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/>.
*
* Written by: Kalev Lember <klember@redhat.com>
*/
#pragma once
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define CC_TYPE_SUBSCRIPTION_REGISTER_DIALOG (cc_subscription_register_dialog_get_type ())
G_DECLARE_FINAL_TYPE (CcSubscriptionRegisterDialog, cc_subscription_register_dialog, CC, SUBSCRIPTION_REGISTER_DIALOG, GtkDialog)
-CcSubscriptionRegisterDialog *cc_subscription_register_dialog_new (GDBusProxy *subscription_proxy);
+CcSubscriptionRegisterDialog *cc_subscription_register_dialog_new (GDBusProxy *subscription_proxy,
+ GCancellable *cancellable);
G_END_DECLS
--
2.28.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,708 @@
From c96f608b5d6c3ac12cb8bf76e4688f6c0e8dd059 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 23 Apr 2019 19:29:41 +0200
Subject: [PATCH 1/3] network: Rename section header
The "Bluetooth" section is actually a catchall section for all
device types we don't know much specifically (Includes, but not
limited to Bluetooth).
Rename/relabel it to something more comprehensive.
Closes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/488
---
panels/network/network.ui | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/panels/network/network.ui b/panels/network/network.ui
index 14c70cd..189febf 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -87,7 +87,7 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
- <!-- Bluetooth header -->
+ <!-- "Other Devices" header -->
<child>
<object class="GtkBox">
<property name="visible">True</property>
@@ -98,7 +98,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
- <property name="label" translatable="yes">Bluetooth</property>
+ <property name="label" translatable="yes">Other Devices</property>
<attributes>
<attribute name="weight" value="bold" />
</attributes>
--
2.27.0.rc2
From fc48e7e618a92f9d52cd61a9ef9b14bf889a9ef3 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 23 Apr 2019 19:46:32 +0200
Subject: [PATCH 2/3] network: Handle Infiniband as a wired interface
The configuration/UI we expose for wired settings are meaningful for those
devices as well.
Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/489
---
panels/network/cc-network-panel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 51ea823..5cdf616 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -461,6 +461,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
/* map the NMDeviceType to the GType, or ignore */
switch (type) {
case NM_DEVICE_TYPE_ETHERNET:
+ case NM_DEVICE_TYPE_INFINIBAND:
device_g_type = NET_TYPE_DEVICE_ETHERNET;
break;
case NM_DEVICE_TYPE_MODEM:
--
2.27.0.rc2
From f71f867f35a8a6c437d2d525e39f3846e0782e4b Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 11 Jun 2020 14:16:03 +0200
Subject: [PATCH 3/3] Update translations
---
po/ca.po | 4 ++++
po/cs.po | 4 ++++
po/da.po | 4 ++++
po/de.po | 4 ++++
po/el.po | 4 ++++
po/en_GB.po | 4 ++++
po/eo.po | 4 ++++
po/es.po | 4 ++++
po/eu.po | 4 ++++
po/fa.po | 4 ++++
po/fi.po | 4 ++++
po/fr.po | 4 ++++
po/fur.po | 4 ++++
po/gl.po | 4 ++++
po/hr.po | 4 ++++
po/hu.po | 4 ++++
po/id.po | 4 ++++
po/it.po | 4 ++++
po/ja.po | 4 ++++
po/ko.po | 4 ++++
po/lt.po | 4 ++++
po/ms.po | 4 ++++
po/nb.po | 4 ++++
po/ne.po | 4 ++++
po/nl.po | 4 ++++
po/oc.po | 5 +++++
po/pa.po | 4 ++++
po/pl.po | 4 ++++
po/pt_BR.po | 4 ++++
po/ro.po | 4 ++++
po/ru.po | 4 ++++
po/sk.po | 4 ++++
po/sl.po | 4 ++++
po/sr.po | 4 ++++
po/sv.po | 4 ++++
po/tr.po | 4 ++++
po/uk.po | 5 +++++
po/zh_CN.po | 4 ++++
po/zh_TW.po | 4 ++++
39 files changed, 158 insertions(+)
diff --git a/po/ca.po b/po/ca.po
index 0592282..36172d9 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -224,6 +224,10 @@ msgstr "Desactiveu el mode d'avió per a habilitar el Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Altres dispositius"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Activeu i desactiveu el Bluetooth i connecteu els dispositius"
diff --git a/po/cs.po b/po/cs.po
index 7d6c2cc..b827d87 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -226,6 +226,10 @@ msgstr "Vypněte přepínač režimu „letadlo“, aby se povolilo Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Ostatní zařízení"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Zapnout a vypnout Bluetooth a připojit se k zařízením"
diff --git a/po/da.po b/po/da.po
index dc85493..bfcd034 100644
--- a/po/da.po
+++ b/po/da.po
@@ -234,6 +234,10 @@ msgstr "Sluk for kontakten Flytilstand for at aktivere Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Andre enheder"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Slå Bluetooth til eller fra og tilslut dine enheder"
diff --git a/po/de.po b/po/de.po
index 78325a2..a5d65f8 100644
--- a/po/de.po
+++ b/po/de.po
@@ -230,6 +230,10 @@ msgstr ""
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Weitere Geräte"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Schalten Sie Bluetooth an oder aus und verbinden Sie Ihre Geräte"
diff --git a/po/el.po b/po/el.po
index a4a1374..81120c7 100644
--- a/po/el.po
+++ b/po/el.po
@@ -2934,6 +2934,10 @@ msgstr "Απενεργοποίηση συσκευής"
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Άλλες συσκευές"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr "Δεν είναι ρυθμισμένο"
diff --git a/po/en_GB.po b/po/en_GB.po
index 96733a1..1bba5a6 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -213,6 +213,10 @@ msgstr "Turn off the Aeroplane mode switch to enable Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Other Devices"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Turn Bluetooth on and off and connect your devices"
diff --git a/po/eo.po b/po/eo.po
index a13393b..473ed08 100644
--- a/po/eo.po
+++ b/po/eo.po
@@ -3000,6 +3000,10 @@ msgstr "Elŝalti aparaton"
msgid "Bluetooth"
msgstr "Bludento"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Aliaj aparatoj"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr ""
diff --git a/po/es.po b/po/es.po
index b59dcd8..4ae235b 100644
--- a/po/es.po
+++ b/po/es.po
@@ -221,6 +221,10 @@ msgstr "Apague el modo avión para activar el Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Otros dispositivos"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Activar y desactivar Bluetooth y conectar sus dispositivos"
diff --git a/po/eu.po b/po/eu.po
index b702316..8ed6d30 100644
--- a/po/eu.po
+++ b/po/eu.po
@@ -2906,6 +2906,10 @@ msgstr "Desaktibatu gailua"
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Beste gailuak"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr "Konfiguratu gabe"
diff --git a/po/fa.po b/po/fa.po
index 12a92ac..101b73c 100644
--- a/po/fa.po
+++ b/po/fa.po
@@ -2792,6 +2792,10 @@ msgstr "خاموش کردن دستگاه"
msgid "Bluetooth"
msgstr "بلوتوث"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "دیگر دستگاه‌ها"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr "برپا نشده"
diff --git a/po/fi.po b/po/fi.po
index 30f8098..b278e0f 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -228,6 +228,10 @@ msgstr "Poista lentokonetila käytöstä käyttääksesi Bluetoothia."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Muut laitteet"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Kytke Bluetooth päälle tai pois ja yhdistä laitteita"
diff --git a/po/fr.po b/po/fr.po
index fbe309a..7c55fd2 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -241,6 +241,10 @@ msgstr "Désactivez le mode avion pour activer le Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Autres périphériques"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Active/désactive le Bluetooth et connecte vos périphériques"
diff --git a/po/fur.po b/po/fur.po
index 7cc4bb2..7bdfcba 100644
--- a/po/fur.po
+++ b/po/fur.po
@@ -211,6 +211,10 @@ msgstr "Distude il cric de modalitât Avion par abilitâ il Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Altris dispositîfs"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Impie e distude il Bluetooth e conet i tiei dispositîfs"
diff --git a/po/gl.po b/po/gl.po
index 6a2061f..b4763b7 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -222,6 +222,10 @@ msgstr "Apague o modo avión para activar o Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Outros dispositivos"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Active ou desactive o Bluetooth e conecte os seus dispositivos"
diff --git a/po/hr.po b/po/hr.po
index 480fe50..740ef7b 100644
--- a/po/hr.po
+++ b/po/hr.po
@@ -209,6 +209,10 @@ msgstr "Isključite način rada u zrakoplovu kako bi mogli kristiti Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Ostali uređaji"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Uključite ili isključite Bluetooth i povežite svoje uređaje"
diff --git a/po/hu.po b/po/hu.po
index 9fddf1c..41b0e51 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -220,6 +220,10 @@ msgstr ""
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Egyéb eszközök"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Kapcsolja be és ki a Bluetooth-t, majd csatlakoztassa eszközeit"
diff --git a/po/id.po b/po/id.po
index ad2772a..49c370d 100644
--- a/po/id.po
+++ b/po/id.po
@@ -213,6 +213,10 @@ msgstr "Matikan saklar mode Pesawat Terbang untuk memfungsikan Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Perangkat Lainnya"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Nyalakan dan matikan Bluetooth dan sambungkan perangkat Anda"
diff --git a/po/it.po b/po/it.po
index cdbc7b0..1390c7c 100644
--- a/po/it.po
+++ b/po/it.po
@@ -216,6 +216,10 @@ msgstr "Disattivare la modalità aereo via hardware per abilitare il Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Altri dispositivi"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Attiva e disattiva il Bluetooth e connette i propri dispositivi"
diff --git a/po/ja.po b/po/ja.po
index 5f4767f..bc144dd 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -2893,6 +2893,10 @@ msgstr "デバイスをオフにする"
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "その他のデバイス"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr "未設定"
diff --git a/po/ko.po b/po/ko.po
index 49d9c2f..3d350b2 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -230,6 +230,10 @@ msgstr "블루투스를 사용하려면 비행 모드 스위치를 끄십시오.
msgid "Bluetooth"
msgstr "블루투스"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "기타 장치"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "블루투스를 켜거나 끄고 블루투스 장치에 연결합니다"
diff --git a/po/lt.po b/po/lt.po
index 3a1292e..9328564 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -220,6 +220,10 @@ msgstr "Išjunkite skrydžio veiksenos jungiklį Bluetooth įjungimui."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Kiti įrenginiai"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Įjunkite arba išjunkite Bluetooth ir junkitės prie savo įrenginių"
diff --git a/po/ms.po b/po/ms.po
index c78df1b..e90eec8 100644
--- a/po/ms.po
+++ b/po/ms.po
@@ -2723,6 +2723,10 @@ msgstr "Profail ujian:"
msgid "VPN"
msgstr ""
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Lain-lain Peranti"
+
#: ../panels/network/connection-editor/net-connection-editor.c:578
msgid "Bond"
msgstr ""
diff --git a/po/nb.po b/po/nb.po
index e1e4b11..02815b2 100644
--- a/po/nb.po
+++ b/po/nb.po
@@ -2842,6 +2842,10 @@ msgstr "Slå enhet av"
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Andre enheter"
+
#: ../panels/network/network.ui.h:3
msgid "Not set up"
msgstr "Ikke satt opp"
diff --git a/po/ne.po b/po/ne.po
index 6cd1bb9..ad3a137 100644
--- a/po/ne.po
+++ b/po/ne.po
@@ -2448,6 +2448,10 @@ msgstr "नायाँ प्रोफाइल"
msgid "VPN"
msgstr "भीपीएन"
+#: panels/network/network.ui:102
+msgid "Other Devices"
+msgstr "अरु यन्त्रहरू "
+
#: ../panels/network/connection-editor/net-connection-editor.c:751
msgid "Import from file…"
msgstr "फाईलबाट आयात गर्नुहोस्"
diff --git a/po/nl.po b/po/nl.po
index 3b48a77..d81a865 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -233,6 +233,10 @@ msgstr "Vliegtuigstand uitschakelen om Bluetooth mogelijk te maken."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Overige apparaten"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Bluetooth aan- en uitzetten en uw apparaten aansluiten"
diff --git a/po/oc.po b/po/oc.po
index bcd7fbe..025b78b 100644
--- a/po/oc.po
+++ b/po/oc.po
@@ -2815,6 +2815,11 @@ msgstr "Apondre lo periferic"
msgid "Remove Device"
msgstr "Levar lo periferic"
+#: panels/network/network.ui:102
+#| msgid "Devices"
+msgid "Other Devices"
+msgstr "Autres periferics"
+
#: ../panels/network/network-vpn.ui.h:1
msgid "VPN Type"
msgstr "Tipe de VPN"
diff --git a/po/pa.po b/po/pa.po
index ce50b62..a894921 100644
--- a/po/pa.po
+++ b/po/pa.po
@@ -215,6 +215,10 @@ msgstr "ਬਲੂਟੁੱਥ ਨੂੰ ਸਮਰੱਥ ਕਰਨ ਲਈ ਏਅ
msgid "Bluetooth"
msgstr "ਬਲੂਟੁੱਥ"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "ਹੋਰ ਡਿਵਾਈਸ"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "ਬਲੂਟੁੱਥ ਜੰਤਰ ਨੂੰ ਚਾਲੂ ਤੇ ਬੰਦ ਕਰੋ ਅਤੇ ਆਪਣੇ ਜੰਤਰਾਂ ਨਾਲ ਕਨੈਕਟ ਕਰੋ-"
diff --git a/po/pl.po b/po/pl.po
index 9093e4e..c1536f4 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -214,6 +214,10 @@ msgstr "Należy wyłączyć przełącznik trybu sprzętowego, aby włączyć Blu
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Inne urządzenia"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Włączanie Bluetooth i łączenie z urządzeniami"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index acad283..bc0861b 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -236,6 +236,10 @@ msgstr "Desligue o alternador do modo avião para habilitar o Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Outros dispositivos"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Ligue e desligue o Bluetooth e conecte seus dispositivos"
diff --git a/po/ro.po b/po/ro.po
index 10fc7eb..6d3f307 100644
--- a/po/ro.po
+++ b/po/ro.po
@@ -221,6 +221,10 @@ msgstr "Opriți modul avion pentru a putea activa Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:102
+msgid "Other Devices"
+msgstr "Alte dispozitive"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Deschideți și închideți Bluetooth și conectați-vă dispozitivele"
diff --git a/po/ru.po b/po/ru.po
index 52762fd..414b598 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -226,6 +226,10 @@ msgstr "Для включения Bluetooth выключите режим для
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Другие устройства"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Включение и отключение Bluetooth. Подключение устройств Bluetooth"
diff --git a/po/sk.po b/po/sk.po
index 3d67fb2..1a4ee5e 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -231,6 +231,10 @@ msgstr "Vypnite prepínač režimu v lietadle na povolenie rozhrania Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Ostatné zariadenia"
+
# desktop entry comment
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
diff --git a/po/sl.po b/po/sl.po
index ba5f934..5008f64 100644
--- a/po/sl.po
+++ b/po/sl.po
@@ -215,6 +215,10 @@ msgstr "Izklopi letalski način za omogočanje vmesnika Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Druge naprave"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Vklopite in izklopite Bluetooth in povežite svoje naprave"
diff --git a/po/sr.po b/po/sr.po
index 1c747a4..6604629 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -218,6 +218,10 @@ msgstr "Искључите авионски режим рада бисте ук
msgid "Bluetooth"
msgstr "Блутут"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Други уређаји"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Укључите или искључите блутут и повежите ваше уређаје"
diff --git a/po/sv.po b/po/sv.po
index d8f4138..25567fb 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -217,6 +217,10 @@ msgstr "Slå av växelknappen för flygplansläge för att aktivera Bluetooth."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Andra enheter"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Slå på samt av Bluetooth och anslut dina enheter"
diff --git a/po/tr.po b/po/tr.po
index 7ac1573..5ef1d82 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -220,6 +220,10 @@ msgstr "Bluetoothu etkinleştirmek için Uçak kipini kapat."
msgid "Bluetooth"
msgstr "Bluetooth"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "Diğer Aygıtlar"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "Bluetoothu açıp kapatın ve aygıtlarınızı bağlayın"
diff --git a/po/uk.po b/po/uk.po
index 9e9d8dc..4bc1cbb 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -2900,6 +2900,11 @@ msgstr "Додати пристрій"
msgid "Remove Device"
msgstr "Вилучити носій"
+#: panels/network/network.ui:68
+#| msgid "Devices"
+msgid "Other Devices"
+msgstr "Інші пристрої"
+
#: ../panels/network/network-vpn.ui.h:1
msgid "VPN Type"
msgstr "Тип VPN"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 3c7050c..c3153b1 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -2780,6 +2780,10 @@ msgstr "添加设备"
msgid "Remove Device"
msgstr "移除设备"
+#: panels/network/network.ui:102
+msgid "Other Devices"
+msgstr "其他设备"
+
#: ../panels/network/network-vpn.ui.h:1
msgid "VPN Type"
msgstr "VPN 类型"
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 8d5a5a0..e0de674 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -215,6 +215,10 @@ msgstr "關閉飛安模式開關以啟用藍牙。"
msgid "Bluetooth"
msgstr "藍牙"
+#: panels/network/network.ui:68
+msgid "Other Devices"
+msgstr "其他裝置"
+
#: panels/bluetooth/gnome-bluetooth-panel.desktop.in.in:4
msgid "Turn Bluetooth on and off and connect your devices"
msgstr "開啟或關閉藍牙與連接您的裝置"
--
2.27.0.rc2

View File

@ -0,0 +1,644 @@
--- gnome-control-center-3.28.2/panels/printers/cc-printers-panel.c
+++ gnome-control-center-3.28.2/panels/printers/cc-printers-panel.c
@@ -105,6 +105,8 @@ struct _CcPrintersPanelPrivate
gchar *renamed_printer_name;
gchar *old_printer_name;
gchar *deleted_printer_name;
+ GList *deleted_printers;
+ GObject *reference;
GHashTable *printer_entries;
gboolean entries_filled;
@@ -267,18 +269,40 @@ printer_removed_cb (GObject *source
GAsyncResult *result,
gpointer user_data)
{
- GError *error = NULL;
+ PpPrinter *printer = PP_PRINTER (source_object);
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *printer_name = NULL;
- pp_printer_delete_finish (PP_PRINTER (source_object), result, &error);
- g_object_unref (source_object);
+ g_object_get (printer, "printer-name", &printer_name, NULL);
+ pp_printer_delete_finish (printer, result, &error);
- if (error != NULL)
+ if (user_data != NULL)
{
- g_warning ("Printer could not be deleted: %s", error->message);
- g_error_free (error);
+ g_autoptr(GObject) reference = G_OBJECT (user_data);
+
+ if (g_object_get_data (reference, "self") != NULL)
+ {
+ CcPrintersPanel *self = CC_PRINTERS_PANEL (g_object_get_data (reference, "self"));
+ CcPrintersPanelPrivate *priv = self->priv;
+ GList *iter;
+
+ for (iter = priv->deleted_printers; iter != NULL; iter = iter->next)
+ {
+ if (g_strcmp0 (iter->data, printer_name) == 0)
+ {
+ g_free (iter->data);
+ priv->deleted_printers = g_list_delete_link (priv->deleted_printers, iter);
+ break;
+ }
+ }
+ }
}
+
+ if (error != NULL)
+ g_warning ("Printer could not be deleted: %s", error->message);
}
+
static void
cc_printers_panel_dispose (GObject *object)
{
@@ -368,6 +392,12 @@ cc_printers_panel_dispose (GObject *obje
g_clear_pointer (&priv->printer_entries, g_hash_table_destroy);
+ g_list_free_full (priv->deleted_printers, g_free);
+ priv->deleted_printers = NULL;
+ if (priv->reference != NULL)
+ g_object_set_data (priv->reference, "self", NULL);
+ g_clear_object (&priv->reference);
+
G_OBJECT_CLASS (cc_printers_panel_parent_class)->dispose (object);
}
@@ -740,13 +770,16 @@ on_printer_deletion_undone (GtkButton *b
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
+ GtkWidget *widget;
priv = PRINTERS_PANEL_PRIVATE (self);
gtk_revealer_set_reveal_child (priv->notification, FALSE);
g_clear_pointer (&priv->deleted_printer_name, g_free);
- actualize_printers_list (self);
+
+ widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "content");
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (widget));
cancel_notification_timeout (self);
}
@@ -768,9 +801,11 @@ on_notification_dismissed (GtkButton *bu
pp_printer_delete_async (printer,
NULL,
printer_removed_cb,
- NULL);
+ g_object_ref (priv->reference));
- g_clear_pointer (&priv->deleted_printer_name, g_free);
+ priv->deleted_printers = g_list_prepend (priv->deleted_printers, priv->deleted_printer_name);
+ priv->deleted_printer_name = NULL;
+ g_object_unref (printer);
}
gtk_revealer_set_reveal_child (priv->notification, FALSE);
@@ -793,8 +828,7 @@ on_printer_deleted (PpPrinterEntry *prin
GtkLabel *label;
gchar *notification_message;
gchar *printer_name;
-
- gtk_widget_hide (GTK_WIDGET (printer_entry));
+ GtkWidget *widget;
priv = PRINTERS_PANEL_PRIVATE (self);
@@ -816,6 +850,9 @@ on_printer_deleted (PpPrinterEntry *prin
priv->deleted_printer_name = g_strdup (printer_name);
g_free (printer_name);
+ widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "content");
+ gtk_list_box_invalidate_filter (GTK_LIST_BOX (widget));
+
gtk_revealer_set_reveal_child (priv->notification, TRUE);
priv->remove_printer_timeout_id = g_timeout_add_seconds (10, on_remove_printer_timeout, self);
@@ -910,6 +947,36 @@ set_current_page (GObject *source_o
}
static void
+destroy_nonexisting_entries (PpPrinterEntry *entry,
+ gpointer user_data)
+{
+ CcPrintersPanelPrivate *priv;
+ CcPrintersPanel *self = (CcPrintersPanel *) user_data;
+ g_autofree gchar *printer_name = NULL;
+ gboolean exists = FALSE;
+ gint i;
+
+ priv = PRINTERS_PANEL_PRIVATE (self);
+
+ g_object_get (G_OBJECT (entry), "printer-name", &printer_name, NULL);
+
+ for (i = 0; i < priv->num_dests; i++)
+ {
+ if (g_strcmp0 (priv->dests[i].name, printer_name) == 0)
+ {
+ exists = TRUE;
+ break;
+ }
+ }
+
+ if (!exists)
+ {
+ gtk_widget_destroy (GTK_WIDGET (entry));
+ g_hash_table_remove (priv->printer_entries, printer_name);
+ }
+}
+
+static void
actualize_printers_list_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@@ -920,6 +987,7 @@ actualize_printers_list_cb (GObject
PpCups *cups = PP_CUPS (source_object);
PpCupsDests *cups_dests;
gboolean new_printer_available = FALSE;
+ gpointer item;
GError *error = NULL;
int i;
@@ -950,7 +1018,7 @@ actualize_printers_list_cb (GObject
gtk_stack_set_visible_child_name (GTK_STACK (widget), "printers-list");
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "content");
- gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) destroy_nonexisting_entries, self);
for (i = 0; i < priv->num_dests; i++)
{
@@ -961,13 +1029,14 @@ actualize_printers_list_cb (GObject
for (i = 0; i < priv->num_dests; i++)
{
- if (g_strcmp0 (priv->dests[i].name, priv->deleted_printer_name) == 0)
- continue;
-
if (new_printer_available && g_strcmp0 (priv->dests[i].name, priv->old_printer_name) == 0)
continue;
- add_printer_entry (self, priv->dests[i]);
+ item = g_hash_table_lookup (priv->printer_entries, priv->dests[i].name);
+ if (item != NULL)
+ pp_printer_entry_update (PP_PRINTER_ENTRY (item), priv->dests[i], priv->is_authorized);
+ else
+ add_printer_entry (self, priv->dests[i]);
}
if (!priv->entries_filled)
@@ -983,6 +1052,30 @@ actualize_printers_list_cb (GObject
}
update_sensitivity (user_data);
+
+ if (priv->new_printer_name != NULL)
+ {
+ GtkScrolledWindow *scrolled_window;
+ GtkAllocation allocation;
+ GtkAdjustment *adjustment;
+ GtkWidget *printer_entry;
+
+ /* Scroll the view to show the newly added printer-entry. */
+ scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (priv->builder,
+ "scrolled-window"));
+ adjustment = gtk_scrolled_window_get_vadjustment (scrolled_window);
+
+ printer_entry = GTK_WIDGET (g_hash_table_lookup (priv->printer_entries,
+ priv->new_printer_name));
+ if (printer_entry != NULL)
+ {
+ gtk_widget_get_allocation (printer_entry, &allocation);
+ g_clear_pointer (&priv->new_printer_name, g_free);
+
+ gtk_adjustment_set_value (adjustment,
+ allocation.y - gtk_widget_get_margin_top (printer_entry));
+ }
+ }
}
static void
@@ -1028,10 +1121,6 @@ new_printer_dialog_response_cb (PpNewPri
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
- GtkScrolledWindow *scrolled_window;
- GtkAllocation allocation;
- GtkAdjustment *adjustment;
- GtkWidget *printer_entry;
priv = PRINTERS_PANEL_PRIVATE (self);
@@ -1059,22 +1148,6 @@ new_printer_dialog_response_cb (PpNewPri
}
actualize_printers_list (self);
-
- if (priv->new_printer_name == NULL)
- return;
-
- /* Scroll the view to show the newly added printer-entry. */
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (priv->builder,
- "scrolled-window"));
- adjustment = gtk_scrolled_window_get_vadjustment (scrolled_window);
-
- printer_entry = GTK_WIDGET (g_hash_table_lookup (priv->printer_entries,
- priv->new_printer_name));
- gtk_widget_get_allocation (printer_entry, &allocation);
- g_clear_pointer (&priv->new_printer_name, g_free);
-
- gtk_adjustment_set_value (adjustment,
- allocation.y - gtk_widget_get_margin_top (printer_entry));
}
static void
@@ -1288,11 +1361,17 @@ filter_function (GtkListBoxRow *row,
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
GtkWidget *search_entry;
gboolean retval;
- gchar *search;
- gchar *name;
- gchar *location;
- gchar *printer_name;
- gchar *printer_location;
+ g_autofree gchar *search = NULL;
+ g_autofree gchar *name = NULL;
+ g_autofree gchar *location = NULL;
+ g_autofree gchar *printer_name = NULL;
+ g_autofree gchar *printer_location = NULL;
+ GList *iter;
+
+ g_object_get (G_OBJECT (row),
+ "printer-name", &printer_name,
+ "printer-location", &printer_location,
+ NULL);
priv = PRINTERS_PANEL_PRIVATE (self);
@@ -1300,31 +1379,72 @@ filter_function (GtkListBoxRow *row,
gtk_builder_get_object (priv->builder, "search-entry");
if (gtk_entry_get_text_length (GTK_ENTRY (search_entry)) == 0)
- return TRUE;
+ {
+ retval = TRUE;
+ }
+ else
+ {
+ name = cc_util_normalize_casefold_and_unaccent (printer_name);
+ location = cc_util_normalize_casefold_and_unaccent (printer_location);
- g_object_get (G_OBJECT (row),
- "printer-name", &printer_name,
- "printer-location", &printer_location,
- NULL);
+ search = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (GTK_ENTRY (search_entry)));
- name = cc_util_normalize_casefold_and_unaccent (printer_name);
- location = cc_util_normalize_casefold_and_unaccent (printer_location);
+ retval = strstr (name, search) != NULL;
+ if (location != NULL)
+ retval = retval || (strstr (location, search) != NULL);
+ }
- g_free (printer_name);
- g_free (printer_location);
+ if (priv->deleted_printer_name != NULL &&
+ g_strcmp0 (priv->deleted_printer_name, printer_name) == 0)
+ {
+ retval = FALSE;
+ }
- search = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (GTK_ENTRY (search_entry)));
+ if (priv->deleted_printers != NULL)
+ {
+ for (iter = priv->deleted_printers; iter != NULL; iter = iter->next)
+ {
+ if (g_strcmp0 (iter->data, printer_name) == 0)
+ {
+ retval = FALSE;
+ break;
+ }
+ }
+ }
+ return retval;
+}
- retval = strstr (name, search) != NULL;
- if (location != NULL)
- retval = retval || (strstr (location, search) != NULL);
+static gint
+sort_function (GtkListBoxRow *row1,
+ GtkListBoxRow *row2,
+ gpointer user_data)
+{
+ g_autofree gchar *printer_name1 = NULL;
+ g_autofree gchar *printer_name2 = NULL;
- g_free (search);
- g_free (name);
- g_free (location);
+ g_object_get (G_OBJECT (row1),
+ "printer-name", &printer_name1,
+ NULL);
- return retval;
+ g_object_get (G_OBJECT (row2),
+ "printer-name", &printer_name2,
+ NULL);
+
+ if (printer_name1 != NULL)
+ {
+ if (printer_name2 != NULL)
+ return g_ascii_strcasecmp (printer_name1, printer_name2);
+ else
+ return 1;
+ }
+ else
+ {
+ if (printer_name2 != NULL)
+ return -1;
+ else
+ return 0;
+ }
}
static void
@@ -1364,6 +1484,8 @@ cc_printers_panel_init (CcPrintersPanel
priv->renamed_printer_name = NULL;
priv->old_printer_name = NULL;
priv->deleted_printer_name = NULL;
+ priv->deleted_printers = NULL;
+ priv->reference = g_object_new (G_TYPE_OBJECT, NULL);
priv->permission = NULL;
priv->lockdown_settings = NULL;
@@ -1380,6 +1502,8 @@ cc_printers_panel_init (CcPrintersPanel
priv->actualize_printers_list_cancellable = g_cancellable_new ();
priv->cups_status_check_cancellable = g_cancellable_new ();
+ g_object_set_data_full (priv->reference, "self", self, NULL);
+
builder_result = gtk_builder_add_objects_from_resource (priv->builder,
"/org/gnome/control-center/printers/printers.ui",
objects, &error);
@@ -1430,6 +1554,10 @@ cc_printers_panel_init (CcPrintersPanel
"search-changed",
G_CALLBACK (gtk_list_box_invalidate_filter),
widget);
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (widget),
+ sort_function,
+ NULL,
+ NULL);
priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
if (priv->lockdown_settings)
--- gnome-control-center-3.28.2/panels/printers/pp-printer-entry.c
+++ gnome-control-center-3.28.2/panels/printers/pp-printer-entry.c
@@ -45,7 +45,6 @@ struct _PpPrinterEntry
{
GtkListBoxRow parent;
- gchar *printer_uri;
gchar *printer_name;
gchar *ppd_file_name;
int num_jobs;
@@ -156,10 +155,27 @@ pp_printer_entry_set_property (GObject
}
}
+static InkLevelData *
+ink_level_data_new (void)
+{
+ return g_slice_new0 (InkLevelData);
+}
+
+static void
+ink_level_data_free (InkLevelData *data)
+{
+ g_clear_pointer (&data->marker_names, g_free);
+ g_clear_pointer (&data->marker_levels, g_free);
+ g_clear_pointer (&data->marker_colors, g_free);
+ g_clear_pointer (&data->marker_types, g_free);
+ g_slice_free (InkLevelData, data);
+}
+
static void
pp_printer_entry_init (PpPrinterEntry *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
+ self->inklevel = ink_level_data_new ();
}
typedef struct {
@@ -260,9 +276,8 @@ tone_down_color (GdkRGBA *color,
}
static gboolean
-supply_levels_draw_cb (GtkWidget *widget,
- cairo_t *cr,
- PpPrinterEntry *self)
+supply_levels_draw_cb (PpPrinterEntry *self,
+ cairo_t *cr)
{
GtkStyleContext *context;
gboolean is_empty = TRUE;
@@ -271,10 +286,10 @@ supply_levels_draw_cb (GtkWidget *w
gint height;
int i;
- context = gtk_widget_get_style_context (widget);
+ context = gtk_widget_get_style_context (GTK_WIDGET (self->supply_drawing_area));
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
+ width = gtk_widget_get_allocated_width (GTK_WIDGET (self->supply_drawing_area));
+ height = gtk_widget_get_allocated_height (GTK_WIDGET (self->supply_drawing_area));
gtk_render_background (context, cr, 0, 0, width, height);
@@ -376,13 +391,13 @@ supply_levels_draw_cb (GtkWidget *w
if (tooltip_text)
{
- gtk_widget_set_tooltip_text (widget, tooltip_text);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self->supply_drawing_area), tooltip_text);
g_free (tooltip_text);
}
else
{
- gtk_widget_set_tooltip_text (widget, NULL);
- gtk_widget_set_has_tooltip (widget, FALSE);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self->supply_drawing_area), NULL);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (self->supply_drawing_area), FALSE);
}
}
@@ -727,11 +742,34 @@ pp_printer_entry_new (cups_dest_t print
gboolean is_authorized)
{
PpPrinterEntry *self;
+
+ self = g_object_new (PP_PRINTER_ENTRY_TYPE, "printer-name", printer.name, NULL);
+
+ self->clean_command = pp_maintenance_command_new (self->printer_name,
+ "Clean",
+ "all",
+ /* Translators: Name of job which makes printer to clean its heads */
+ _("Clean print heads"));
+ check_clean_heads_maintenance_command (self);
+
+ g_signal_connect_object (self->supply_drawing_area, "draw", G_CALLBACK (supply_levels_draw_cb), self, G_CONNECT_SWAPPED);
+
+ pp_printer_entry_update (self, printer, is_authorized);
+
+ return self;
+}
+
+void
+pp_printer_entry_update (PpPrinterEntry *self,
+ cups_dest_t printer,
+ gboolean is_authorized)
+{
cups_ptype_t printer_type = 0;
- gboolean is_accepting_jobs;
+ gboolean is_accepting_jobs = TRUE;
gboolean ink_supply_is_empty;
gchar *instance;
gchar *printer_uri = NULL;
+ const gchar *device_uri = NULL;
gchar *location = NULL;
gchar *printer_icon_name = NULL;
gchar *default_icon_name = NULL;
@@ -798,10 +836,6 @@ pp_printer_entry_new (cups_dest_t print
N_("The optical photo conductor is no longer functioning")
};
- self = g_object_new (PP_PRINTER_ENTRY_TYPE, "printer-name", printer.name, NULL);
-
- self->inklevel = g_slice_new0 (InkLevelData);
-
if (printer.instance)
{
instance = g_strdup_printf ("%s / %s", printer.name, printer.instance);
@@ -816,7 +850,7 @@ pp_printer_entry_new (cups_dest_t print
for (i = 0; i < printer.num_options; i++)
{
if (g_strcmp0 (printer.options[i].name, "device-uri") == 0)
- self->printer_uri = printer.options[i].value;
+ device_uri = printer.options[i].value;
else if (g_strcmp0 (printer.options[i].name, "printer-uri-supported") == 0)
printer_uri = printer.options[i].value;
else if (g_strcmp0 (printer.options[i].name, "printer-type") == 0)
@@ -826,13 +860,25 @@ pp_printer_entry_new (cups_dest_t print
else if (g_strcmp0 (printer.options[i].name, "printer-state-reasons") == 0)
reason = printer.options[i].value;
else if (g_strcmp0 (printer.options[i].name, "marker-names") == 0)
- self->inklevel->marker_names = g_strcompress (printer.options[i].value);
+ {
+ g_free (self->inklevel->marker_names);
+ self->inklevel->marker_names = g_strcompress (printer.options[i].value);
+ }
else if (g_strcmp0 (printer.options[i].name, "marker-levels") == 0)
- self->inklevel->marker_levels = g_strdup (printer.options[i].value);
+ {
+ g_free (self->inklevel->marker_levels);
+ self->inklevel->marker_levels = g_strdup (printer.options[i].value);
+ }
else if (g_strcmp0 (printer.options[i].name, "marker-colors") == 0)
- self->inklevel->marker_colors = g_strdup (printer.options[i].value);
+ {
+ g_free (self->inklevel->marker_colors);
+ self->inklevel->marker_colors = g_strdup (printer.options[i].value);
+ }
else if (g_strcmp0 (printer.options[i].name, "marker-types") == 0)
- self->inklevel->marker_types = g_strdup (printer.options[i].value);
+ {
+ g_free (self->inklevel->marker_types);
+ self->inklevel->marker_types = g_strdup (printer.options[i].value);
+ }
else if (g_strcmp0 (printer.options[i].name, "printer-make-and-model") == 0)
printer_make_and_model = printer.options[i].value;
else if (g_strcmp0 (printer.options[i].name, "printer-state") == 0)
@@ -896,6 +942,11 @@ pp_printer_entry_new (cups_dest_t print
gtk_label_set_label (self->error_status, status);
gtk_widget_set_visible (GTK_WIDGET (self->printer_error), TRUE);
}
+ else
+ {
+ gtk_label_set_label (self->error_status, "");
+ gtk_widget_set_visible (GTK_WIDGET (self->printer_error), FALSE);
+ }
switch (self->printer_state)
{
@@ -921,7 +972,7 @@ pp_printer_entry_new (cups_dest_t print
break;
}
- if (printer_is_local (printer_type, self->printer_uri))
+ if (printer_is_local (printer_type, device_uri))
printer_icon_name = g_strdup ("printer");
else
printer_icon_name = g_strdup ("printer-network");
@@ -931,14 +982,8 @@ pp_printer_entry_new (cups_dest_t print
self->is_accepting_jobs = is_accepting_jobs;
self->is_authorized = is_authorized;
- self->printer_hostname = printer_get_hostname (printer_type, self->printer_uri, printer_uri);
-
- self->clean_command = pp_maintenance_command_new (self->printer_name,
- "Clean",
- "all",
- /* Translators: Name of job which makes printer to clean its heads */
- _("Clean print heads"));
- check_clean_heads_maintenance_command (self);
+ g_free (self->printer_hostname);
+ self->printer_hostname = printer_get_hostname (printer_type, device_uri, printer_uri);
gtk_image_set_from_icon_name (self->printer_icon, printer_icon_name, GTK_ICON_SIZE_DIALOG);
gtk_label_set_text (self->printer_status, printer_status);
@@ -970,7 +1015,6 @@ pp_printer_entry_new (cups_dest_t print
gtk_label_set_text (self->printer_location_address_label, location);
}
- g_signal_connect (self->supply_drawing_area, "draw", G_CALLBACK (supply_levels_draw_cb), self);
ink_supply_is_empty = supply_level_is_empty (self);
gtk_widget_set_visible (GTK_WIDGET (self->printer_inklevel_label), !ink_supply_is_empty);
gtk_widget_set_visible (GTK_WIDGET (self->supply_frame), !ink_supply_is_empty);
@@ -983,8 +1027,6 @@ pp_printer_entry_new (cups_dest_t print
g_free (instance);
g_free (printer_icon_name);
g_free (default_icon_name);
-
- return self;
}
static void
@@ -1008,6 +1050,7 @@ pp_printer_entry_dispose (GObject *objec
g_clear_pointer (&self->printer_location, g_free);
g_clear_pointer (&self->printer_make_and_model, g_free);
g_clear_pointer (&self->printer_hostname, g_free);
+ g_clear_pointer (&self->inklevel, ink_level_data_free);
if (self->get_jobs_cancellable != NULL)
{
--- gnome-control-center-3.28.2/panels/printers/pp-printer-entry.h
+++ gnome-control-center-3.28.2/panels/printers/pp-printer-entry.h
@@ -42,4 +42,8 @@ void pp_printer_entry_show_jo
void pp_printer_entry_authenticate_jobs (PpPrinterEntry *self);
+void pp_printer_entry_update (PpPrinterEntry *self,
+ cups_dest_t printer,
+ gboolean is_authorized);
+
#endif /* PP_PRINTER_ENTRY_H */

View File

@ -1,7 +1,8 @@
%define gnome_online_accounts_version 3.25.3 %define gnome_online_accounts_version 3.25.3
%define glib2_version 2.53.0 %define glib2_version 2.53.0
%define gnome_desktop_version 3.27.90 %define gnome_desktop_version 3.27.90
%define gsd_version 3.25.90 %define gsd_version 3.32.0-13
%define gsettings_desktop_schemas_version 3.27.2 %define gsettings_desktop_schemas_version 3.27.2
%define gtk3_version 3.22.20 %define gtk3_version 3.22.20
%define upower_version 0.99.6 %define upower_version 0.99.6
@ -10,7 +11,7 @@
Name: gnome-control-center Name: gnome-control-center
Version: 3.28.2 Version: 3.28.2
Release: 21%{?dist} Release: 26%{?dist}
Summary: Utilities to configure the GNOME desktop Summary: Utilities to configure the GNOME desktop
License: GPLv2+ and CC-BY-SA License: GPLv2+ and CC-BY-SA
@ -19,6 +20,7 @@ Source0: https://download.gnome.org/sources/gnome-control-center/3.28/gno
# https://bugzilla.gnome.org/show_bug.cgi?id=695691 # https://bugzilla.gnome.org/show_bug.cgi?id=695691
Patch0: distro-logo.patch Patch0: distro-logo.patch
# thunderbolt panel backported to 3.28.x # thunderbolt panel backported to 3.28.x
# https://gitlab.gnome.org/gicmo/gnome-control-center/commits/thunderbolt_3_28_1 # https://gitlab.gnome.org/gicmo/gnome-control-center/commits/thunderbolt_3_28_1
Patch1: 0001-shell-Don-t-set-per-panel-icon.patch Patch1: 0001-shell-Don-t-set-per-panel-icon.patch
@ -33,7 +35,10 @@ Patch6: 0001-wacom-Update-Test-your-settings-button-sensitivity-o.patch
Patch7: 0001-wacom-Update-to-newer-output-setting.patch Patch7: 0001-wacom-Update-to-newer-output-setting.patch
# Subscription management # Subscription management
Patch8: 0001-info-Add-subscription-manager-integration.patch Patch80001: 0001-info-Add-subscription-manager-integration.patch
Patch80002: 0002-info-Move-helper-for-getting-subscription-status-to-.patch
Patch80003: 0003-info-Update-registration-state-in-panel-when-it-happ.patch
Patch80004: 0004-info-Better-support-registered-but-no-subscriptions-.patch
Patch9: 0001-sharing-Fix-warning-when-disabling-sharing.patch Patch9: 0001-sharing-Fix-warning-when-disabling-sharing.patch
Patch10: 0001-network-Use-g_signal_connect_object-when-dealing-wit.patch Patch10: 0001-network-Use-g_signal_connect_object-when-dealing-wit.patch
@ -52,6 +57,10 @@ Patch21: backport-wacom-tool-id-fixes.patch
Patch22: 0001-power-correct-the-value-of-90-minutes-to-5400.patch Patch22: 0001-power-correct-the-value-of-90-minutes-to-5400.patch
Patch23: 0001-sound-Ensure-to-preserve-sound-theme-when-changing-f.patch Patch23: 0001-sound-Ensure-to-preserve-sound-theme-when-changing-f.patch
Patch24: categorize-infiniband.patch
Patch25: printers-Update-entries.patch
BuildRequires: chrpath BuildRequires: chrpath
BuildRequires: cups-devel BuildRequires: cups-devel
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
@ -224,6 +233,27 @@ chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gnome-control-center
%dir %{_datadir}/gnome/wm-properties %dir %{_datadir}/gnome/wm-properties
%changelog %changelog
* Sun Jan 24 2021 Ray Strode <rstrode@redhat.com> - 3.28.2-26
- Support Simple Content Access from subscription manager
Related: #1870837
* Thu Dec 03 2020 Marek Kasik <mkasik@redhat.com> - 3.28.2-25
- Fix a leak found by Coverity
- Related: #1700002
* Wed Dec 02 2020 Marek Kasik <mkasik@redhat.com> - 3.28.2-24
- Fix crashes when updating printer entries
- Related: #1700002
- Resolves: #1903043
* Tue Nov 24 2020 Marek Kasik <mkasik@redhat.com> - 3.28.2-23
- Update list of printers instead of regenerating it
- Resolves: #1700002
* Wed Sep 02 2020 Carlos Garnacho <cgarnach@redhat.com> - 3.28.2-22
- Categorize Infiniband devices correctly
Resolves: #1826379
* Mon Jun 29 2020 Carlos Garnacho <cgarnach@redhat.com> - 3.28.2-21 * Mon Jun 29 2020 Carlos Garnacho <cgarnach@redhat.com> - 3.28.2-21
- Honor sound theme changes when changing from the default theme - Honor sound theme changes when changing from the default theme
- Resolves: #1706008 - Resolves: #1706008