Update to 42.1

This commit is contained in:
David King 2022-04-27 09:29:52 +01:00
parent 92aef8f21f
commit 1943e4d648
7 changed files with 7 additions and 1138 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@
/gnome-control-center-42.beta.tar.xz
/gnome-control-center-42.rc.tar.xz
/gnome-control-center-42.0.tar.xz
/gnome-control-center-42.1.tar.xz

View File

@ -1,32 +0,0 @@
From 7fe322b9cedae313cd9af6f403eab9bfc6027674 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 28 Mar 2022 21:02:23 +0200
Subject: [PATCH] online-accounts: Fix goa-helper on X11
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The handle_str contains the “x11:” prefix so strtol would return 0.
We need to pass it the numeric substring.
Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1651
---
panels/online-accounts/gnome-control-center-goa-helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/panels/online-accounts/gnome-control-center-goa-helper.c b/panels/online-accounts/gnome-control-center-goa-helper.c
index 56513147e..533609cbc 100644
--- a/panels/online-accounts/gnome-control-center-goa-helper.c
+++ b/panels/online-accounts/gnome-control-center-goa-helper.c
@@ -129,7 +129,7 @@ set_external_parent_from_handle (GtkApplication *application,
int xid;
errno = 0;
- xid = strtol (handle_str, NULL, 16);
+ xid = strtol (handle_str + strlen (x11_prefix), NULL, 16);
if (errno != 0)
{
g_warning ("Failed to reference external X11 window, invalid XID %s", handle_str);
--
2.35.1

View File

@ -12,31 +12,18 @@
%global tarball_version %%(echo %{version} | tr '~' '.')
Name: gnome-control-center
Version: 42.0
Version: 42.1
Release: %autorelease
Summary: Utilities to configure the GNOME desktop
License: GPLv2+ and CC-BY-SA
URL: http://www.gnome.org
Source0: https://download.gnome.org/sources/gnome-control-center/42/gnome-control-center-%{tarball_version}.tar.xz
URL: https://gitlab.gnome.org/GNOME/gnome-control-center/
Source0: https://download.gnome.org/sources/%{name}/42/%{name}-%{tarball_version}.tar.xz
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/965
Patch0: distro-logo.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1144
Patch1: prettify-info.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1272
# Fixes GOA helper window:
# https://bugzilla.redhat.com/show_bug.cgi?id=2064462
Patch2: 0001-online-accounts-Fix-goa-helper-on-X11.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2063410
Patch3: printers-use-gtkdropdown.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1284
Patch4: goa-switches.patch
BuildRequires: chrpath
BuildRequires: cups-devel
BuildRequires: desktop-file-utils
BuildRequires: docbook-style-xsl libxslt
BuildRequires: gcc
@ -46,6 +33,7 @@ BuildRequires: pkgconfig(accountsservice)
BuildRequires: pkgconfig(clutter-gtk-1.0)
BuildRequires: pkgconfig(colord)
BuildRequires: pkgconfig(colord-gtk4)
BuildRequires: pkgconfig(cups)
BuildRequires: pkgconfig(gcr-base-3)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(gdk-wayland-3.0)
@ -72,10 +60,10 @@ BuildRequires: pkgconfig(mm-glib)
BuildRequires: pkgconfig(polkit-gobject-1)
BuildRequires: pkgconfig(pwquality)
BuildRequires: pkgconfig(smbclient)
BuildRequires: pkgconfig(udisks2)
BuildRequires: pkgconfig(upower-glib) >= %{upower_version}
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(udisks2)
%ifnarch s390 s390x
BuildRequires: pkgconfig(gnome-bluetooth-3.0) >= %{gnome_bluetooth_version}
BuildRequires: pkgconfig(libwacom)

View File

@ -1,54 +0,0 @@
From 1e1fbd6891f56428f76baf556486195881e27425 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 19 Apr 2022 23:02:37 +0200
Subject: [PATCH] online-accounts: Fix feature switches not doing anything
Make sure to keep a reference to the GoaObject of the account around so
that the GBinding that synchronises each switch widget and the account
properties don't get finalized on startup.
#0 0x00007ffff73c6a20 in g_binding_finalize () at /lib64/libgobject-2.0.so.0
#1 0x00007ffff73d3d22 in g_object_unref () at /lib64/libgobject-2.0.so.0
#2 0x00007ffff73c68e8 in weak_unbind () at /lib64/libgobject-2.0.so.0
#3 0x00007ffff73cf117 in weak_refs_notify () at /lib64/libgobject-2.0.so.0
#4 0x00007ffff72acd6c in g_data_set_internal () at /lib64/libglib-2.0.so.0
#5 0x00007ffff73d0195 in g_object_real_dispose.lto_priv () at /lib64/libgobject-2.0.so.0
#6 0x00007ffff73d3c44 in g_object_unref () at /lib64/libgobject-2.0.so.0
#7 0x00007ffff72b6793 in g_hash_table_remove_all_nodes.part () at /lib64/libglib-2.0.so.0
#8 0x00007ffff72ba723 in g_hash_table_unref () at /lib64/libglib-2.0.so.0
#9 0x00007ffff753403d in g_dbus_object_proxy_finalize () at /lib64/libgio-2.0.so.0
#10 0x00007ffff73d3d22 in g_object_unref () at /lib64/libgobject-2.0.so.0
#11 0x0000000000402d08 in glib_autoptr_clear_GoaObject (_ptr=0x5d59f0) at /usr/include/goa-1.0/goa/goa-generated.h:3265
#12 glib_autoptr_cleanup_GoaObject (_ptr=<synthetic pointer>) at /usr/include/goa-1.0/goa/goa-generated.h:3265
#13 on_application_activate_show_account_cb (application=0x49f2f0, argv=<optimized out>) at ../../../../Projects/jhbuild/gnome-control-center/panels/online-accounts/gnome-control-center-goa-helper.c:360
Closes: #1721
---
panels/online-accounts/gnome-control-center-goa-helper.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/panels/online-accounts/gnome-control-center-goa-helper.c b/panels/online-accounts/gnome-control-center-goa-helper.c
index 533609cbc..d0e1a478e 100644
--- a/panels/online-accounts/gnome-control-center-goa-helper.c
+++ b/panels/online-accounts/gnome-control-center-goa-helper.c
@@ -385,7 +385,7 @@ on_application_activate_show_account_cb (GtkApplication *application,
}
/* Find the provider with a matching type */
- account = goa_object_peek_account (object);
+ account = goa_object_get_account (object);
provider_type = goa_account_get_provider_type (account);
provider = goa_provider_get_for_provider_type (provider_type);
if (!provider)
@@ -398,6 +398,8 @@ on_application_activate_show_account_cb (GtkApplication *application,
dialog = g_object_new (GTK_TYPE_DIALOG,
"use-header-bar", 1,
NULL);
+ /* Keep account alive so that the switches are still bound to it */
+ g_object_set_data_full (G_OBJECT (dialog), "goa-account", account, g_object_unref);
g_signal_connect_swapped (dialog, "response", G_CALLBACK (g_application_quit), application);
set_external_parent_from_handle (application, GTK_WINDOW (dialog), argv[3]);
--
GitLab

View File

@ -1,447 +0,0 @@
From f64df4e31d0ff714516552fcf647e773fa00ffd2 Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 08:01:08 +0100
Subject: [PATCH 01/10] =?UTF-8?q?info-overview:=20There=20is=20no=20?=
=?UTF-8?q?=E2=80=9CAMD=C2=AE=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
AMD doesnt have a registered trademark for the string only.
---
panels/info-overview/info-cleanup.c | 1 -
tests/info/info-cleanup-test.txt | 10 +++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 5a7392722..b30bf4acc 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -43,7 +43,6 @@ prettify_info (const char *info)
{ "Gallium .* on (AMD .*)", "\\1"},
{ "(AMD .*) [(].*", "\\1"},
{ "(AMD [A-Z])(.*)", "\\1\\L\\2\\E"},
- { "AMD", "AMD\302\256"},
{ "Graphics Controller", "Graphics"},
};
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 6dc72a56e..dd0ea8954 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -1,8 +1,8 @@
Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T CPU @ 2.00GHz
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
-Gallium 0.4 on AMD KAVERI AMD® Kaveri
-AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD® Kaveri
-AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD® Kaveri
-Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD® Kaveri
-Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD® Kaveri
+Gallium 0.4 on AMD KAVERI AMD Kaveri
+AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD Kaveri
+AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD Kaveri
+Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD Kaveri
+Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD Kaveri
--
2.35.1
From 3851a5ca92633d8bf790116bf57143ba9eb85b2b Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 08:03:51 +0100
Subject: [PATCH 02/10] info-overview: If names are all caps, leave them be
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This made everything AMD lower case after the second word
and is likely unintentional for something like EPYC™.
e.g. was
AMD Ryzen threadripper 1950x 16-core processor
AMD Radeon rx 580 series
---
panels/info-overview/info-cleanup.c | 1 -
tests/info/info-cleanup-test.txt | 13 ++++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index b30bf4acc..f723de6f4 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -42,7 +42,6 @@ prettify_info (const char *info)
{ "Atom[(]TM[)]", "Atom\342\204\242"},
{ "Gallium .* on (AMD .*)", "\\1"},
{ "(AMD .*) [(].*", "\\1"},
- { "(AMD [A-Z])(.*)", "\\1\\L\\2\\E"},
{ "Graphics Controller", "Graphics"},
};
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index dd0ea8954..c074fb6f5 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -1,8 +1,11 @@
Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T CPU @ 2.00GHz
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
-Gallium 0.4 on AMD KAVERI AMD Kaveri
-AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD Kaveri
-AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD Kaveri
-Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD Kaveri
-Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD Kaveri
+Gallium 0.4 on AMD KAVERI AMD KAVERI
+AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
+AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
+Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
+Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
+AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X 16-Core Processor
+AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon RX 580 Series
+AMD EPYC 7251 8-Core Processor AMD EPYC 7251 8-Core Processor
--
2.35.1
From 8d44e51983e002c1cac3a9b84e8ba8b6158c1dde Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 08:06:49 +0100
Subject: [PATCH 03/10] info-overview: Always omit Gallium, not just for AMD
---
panels/info-overview/info-cleanup.c | 2 +-
tests/info/info-cleanup-test.txt | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index f723de6f4..a444389c7 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -40,7 +40,7 @@ prettify_info (const char *info)
{ "Intel[(]R[)]", "Intel\302\256"},
{ "Core[(]TM[)]", "Core\342\204\242"},
{ "Atom[(]TM[)]", "Atom\342\204\242"},
- { "Gallium .* on (AMD .*)", "\\1"},
+ { "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
{ "(AMD .*) [(].*", "\\1"},
{ "Graphics Controller", "Graphics"},
};
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index c074fb6f5..637da42ab 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -9,3 +9,5 @@ Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AM
AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X 16-Core Processor
AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon RX 580 Series
AMD EPYC 7251 8-Core Processor AMD EPYC 7251 8-Core Processor
+Gallium 0.4 on SVGA3D SVGA3D
+Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe (LLVM 3.4, 128 bits)
--
2.35.1
From 3cf413e65a3c30f514e5dd4f9d09e9b1aab7f4cb Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 08:25:21 +0100
Subject: [PATCH 04/10] info-overview: Use a more generic regex to match the
Mesa infos
---
panels/info-overview/info-cleanup.c | 2 +-
tests/info/info-cleanup-test.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index a444389c7..10418a5ec 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -41,7 +41,7 @@ prettify_info (const char *info)
{ "Core[(]TM[)]", "Core\342\204\242"},
{ "Atom[(]TM[)]", "Atom\342\204\242"},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
- { "(AMD .*) [(].*", "\\1"},
+ { " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
};
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 637da42ab..2f4327977 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -10,4 +10,4 @@ AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X 16-C
AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon RX 580 Series
AMD EPYC 7251 8-Core Processor AMD EPYC 7251 8-Core Processor
Gallium 0.4 on SVGA3D SVGA3D
-Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe (LLVM 3.4, 128 bits)
+Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
--
2.35.1
From 71ecb8b1293e868ac1fb19eb6655436d71f445d3 Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 08:09:46 +0100
Subject: [PATCH 05/10] info-overview: Replace the trademark symbols in a more
generic way
---
panels/info-overview/info-cleanup.c | 5 ++---
tests/info/info-cleanup-test.txt | 2 ++
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 10418a5ec..25d957a1d 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -37,9 +37,8 @@ prettify_info (const char *info)
int i;
static const ReplaceStrings rs[] = {
{ "Mesa DRI ", ""},
- { "Intel[(]R[)]", "Intel\302\256"},
- { "Core[(]TM[)]", "Core\342\204\242"},
- { "Atom[(]TM[)]", "Atom\342\204\242"},
+ { "[(]R[)]", "\302\256"},
+ { "[(](tm|TM)[)]", "\342\204\242"},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
{ " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 2f4327977..e8ca5da0f 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -11,3 +11,5 @@ AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 1
AMD EPYC 7251 8-Core Processor AMD EPYC 7251 8-Core Processor
Gallium 0.4 on SVGA3D SVGA3D
Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
+AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350 Eight-Core Processor
+AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435 Processor
--
2.35.1
From 307b420c90763d03e8a32d74dc5cf23d39d1b689 Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 10:58:55 +0100
Subject: [PATCH 06/10] info-overview: Remove some junk info, like PCIe and SSE
---
panels/info-overview/info-cleanup.c | 1 +
tests/info/info-cleanup-test.txt | 2 ++
2 files changed, 3 insertions(+)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 25d957a1d..f0e8cc772 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -40,6 +40,7 @@ prettify_info (const char *info)
{ "[(]R[)]", "\302\256"},
{ "[(](tm|TM)[)]", "\342\204\242"},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
+ { " x86|/MMX|/SSE2|/PCIe", ""},
{ " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
};
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index e8ca5da0f..ce8084305 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -13,3 +13,5 @@ Gallium 0.4 on SVGA3D SVGA3D
Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350 Eight-Core Processor
AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435 Processor
+NVIDIA GeForce GT 710/PCIe/SSE2 NVIDIA GeForce GT 710
+Mesa DRI Intel(R) 965GM x86/MMX/SSE2 Intel® 965GM
--
2.35.1
From da98faf10360d8a278e672a44858c1c249101d53 Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 10:31:17 +0100
Subject: [PATCH 07/10] info-overview: Remove redundant/elaborate info
Remove redundant/elaborate in strings like CPU, Core and Processor.
---
panels/info-overview/info-cleanup.c | 1 +
tests/info/info-cleanup-test.txt | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index f0e8cc772..21ea83dd3 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -40,6 +40,7 @@ prettify_info (const char *info)
{ "[(]R[)]", "\302\256"},
{ "[(](tm|TM)[)]", "\342\204\242"},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
+ { " CPU| Processor| \\S+-Core", ""},
{ " x86|/MMX|/SSE2|/PCIe", ""},
{ " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index ce8084305..6de8e0bc5 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -1,4 +1,4 @@
-Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T CPU @ 2.00GHz
+Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T @ 2.00GHz
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Gallium 0.4 on AMD KAVERI AMD KAVERI
@@ -6,12 +6,12 @@ AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
-AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X 16-Core Processor
+AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X
AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon RX 580 Series
-AMD EPYC 7251 8-Core Processor AMD EPYC 7251 8-Core Processor
+AMD EPYC 7251 8-Core Processor AMD EPYC 7251
Gallium 0.4 on SVGA3D SVGA3D
Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
-AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350 Eight-Core Processor
-AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435 Processor
+AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350
+AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435
NVIDIA GeForce GT 710/PCIe/SSE2 NVIDIA GeForce GT 710
Mesa DRI Intel(R) 965GM x86/MMX/SSE2 Intel® 965GM
--
2.35.1
From 4132e8856c8c1b6dfc64745e17d64078b4aa05cc Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 10:29:15 +0100
Subject: [PATCH 08/10] info-overview: Remove some rare @ x.yz GHz
specification
---
panels/info-overview/info-cleanup.c | 2 +-
tests/info/info-cleanup-test.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 21ea83dd3..7d640bb64 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -40,7 +40,7 @@ prettify_info (const char *info)
{ "[(]R[)]", "\302\256"},
{ "[(](tm|TM)[)]", "\342\204\242"},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
- { " CPU| Processor| \\S+-Core", ""},
+ { " CPU| Processor| \\S+-Core| @ \\d+\\.\\d+GHz", ""},
{ " x86|/MMX|/SSE2|/PCIe", ""},
{ " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 6de8e0bc5..72b92071a 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -1,4 +1,4 @@
-Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T @ 2.00GHz
+Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
Gallium 0.4 on AMD KAVERI AMD KAVERI
--
2.35.1
From ad01dc194e5e1e9876da611e70ac451af9bd1442 Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 11:10:04 +0100
Subject: [PATCH 09/10] info-overview: Add some commonly used trademarks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Those are not always present in the device string.
Guidance was taken from the usage on vendor websites.
NVIDIA actually has the rights to GTX™ but doesnt seem to use it,
in contrast to RTX™.
---
panels/info-overview/info-cleanup.c | 1 +
tests/info/info-cleanup-test.txt | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index 7d640bb64..ceeb61025 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -39,6 +39,7 @@ prettify_info (const char *info)
{ "Mesa DRI ", ""},
{ "[(]R[)]", "\302\256"},
{ "[(](tm|TM)[)]", "\342\204\242"},
+ { "(ATI|EPYC|AMD FX|Radeon|Ryzen|Threadripper|GeForce RTX) ", "\\1\342\204\242 "},
{ "Gallium \\d+\\.\\d+ on (.*)", "\\1"},
{ " CPU| Processor| \\S+-Core| @ \\d+\\.\\d+GHz", ""},
{ " x86|/MMX|/SSE2|/PCIe", ""},
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 72b92071a..80be85135 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -6,12 +6,13 @@ AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3) AMD KAVERI
Gallium 0.4 on AMD KAVERI (DRM 2.48.0 / 4.9.0-0.rc4.git2.2.fc26.x86_64, LLVM3 AMD KAVERI
-AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen Threadripper 1950X
-AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon RX 580 Series
-AMD EPYC 7251 8-Core Processor AMD EPYC 7251
+AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen™ Threadripper™ 1950X
+AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon™ RX 580 Series
+AMD EPYC 7251 8-Core Processor AMD EPYC™ 7251
Gallium 0.4 on SVGA3D SVGA3D
Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350
AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435
NVIDIA GeForce GT 710/PCIe/SSE2 NVIDIA GeForce GT 710
Mesa DRI Intel(R) 965GM x86/MMX/SSE2 Intel® 965GM
+NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA GeForce RTX™ 3090
--
2.35.1
From 160fbfe8aa0cb396c1a0c31e1199f32da0c4c79e Mon Sep 17 00:00:00 2001
From: Norbert Pfeiler <norbert.pfeiler+git@gmail.com>
Date: Sat, 29 Jan 2022 10:56:33 +0100
Subject: [PATCH 10/10] =?UTF-8?q?info-overview:=20Replace=20llvmpipe=20wit?=
=?UTF-8?q?h=20=E2=80=9CSoftware=20Rendering=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
panels/info-overview/info-cleanup.c | 1 +
tests/info/info-cleanup-test.txt | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/panels/info-overview/info-cleanup.c b/panels/info-overview/info-cleanup.c
index ceeb61025..5c3480ca7 100644
--- a/panels/info-overview/info-cleanup.c
+++ b/panels/info-overview/info-cleanup.c
@@ -45,6 +45,7 @@ prettify_info (const char *info)
{ " x86|/MMX|/SSE2|/PCIe", ""},
{ " [(][^)]*(DRM|MESA|LLVM)[^)]*[)]?", ""},
{ "Graphics Controller", "Graphics"},
+ { ".*llvmpipe.*", "Software Rendering"},
};
if (*info == '\0')
diff --git a/tests/info/info-cleanup-test.txt b/tests/info/info-cleanup-test.txt
index 80be85135..a0e25fbd0 100644
--- a/tests/info/info-cleanup-test.txt
+++ b/tests/info/info-cleanup-test.txt
@@ -10,7 +10,8 @@ AMD Ryzen Threadripper 1950X 16-Core Processor AMD Ryzen™ Threadripper™ 1950
AMD Radeon RX 580 Series (POLARIS10, DRM 3.42.0, 5.15.13-1-ck-generic-v3, LLVM 13.0.0) AMD Radeon™ RX 580 Series
AMD EPYC 7251 8-Core Processor AMD EPYC™ 7251
Gallium 0.4 on SVGA3D SVGA3D
-Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) llvmpipe
+Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) Software Rendering
+llvmpipe (LLVM 12.0.1, 256 bits) Software Rendering
AMD FX(tm)-8350 Eight-Core Processor AMD FX™-8350
AMD Athlon(tm) II X3 435 Processor AMD Athlon™ II X3 435
NVIDIA GeForce GT 710/PCIe/SSE2 NVIDIA GeForce GT 710
--
2.35.1

View File

@ -1,587 +0,0 @@
From 7c5beecc97145962fa844f1d102b5a780ca55f7a Mon Sep 17 00:00:00 2001
From: Brandon Nielsen <nielsenb@jetfuse.net>
Date: Fri, 25 Mar 2022 20:54:47 -0500
Subject: [PATCH] printers: Use a GtkDropDown in PpOptionsDialog
PpPpdOptionWidget and PpIppOptionWidget both use combo boxes for
certain types of selections. With GTK4, combo boxes no longer
support scrolling[0], which in turn causes problems setting some
things in the PpOptionsDialog[1].
This replaces instances of GtkComboBox with GtkDropDown which do
support scrolling. This change was applied to both PpIppOptionWidget
and PpPpdOptionWidget as both are used in PpOptions dialog.
Since the configuration values passed to CUPS can no longer be stored
in a GtkTreeModel alongside the displayed values, some logic changes
to update_widget_real in PpPpdOptionWidget to maintain the reference
to the ppd_option_t so the selected index can be mapped to the
configuration value.
[0] - https://gitlab.gnome.org/GNOME/gtk/-/issues/3674
[1] - https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1704
---
panels/printers/pp-ipp-option-widget.c | 165 ++++++++++--------------
panels/printers/pp-ppd-option-widget.c | 167 +++++++++----------------
2 files changed, 125 insertions(+), 207 deletions(-)
diff --git a/panels/printers/pp-ipp-option-widget.c b/panels/printers/pp-ipp-option-widget.c
index 8ab7ea06f..ea27ad737 100644
--- a/panels/printers/pp-ipp-option-widget.c
+++ b/panels/printers/pp-ipp-option-widget.c
@@ -40,7 +40,7 @@ struct _PpIPPOptionWidget
GtkWidget *switch_button;
GtkWidget *spin_button;
- GtkWidget *combo;
+ GtkWidget *dropdown;
IPPAttribute *option_supported;
IPPAttribute *option_default;
@@ -85,8 +85,10 @@ ipp_choice_translate (const gchar *option,
for (i = 0; i < G_N_ELEMENTS (ipp_choice_translations); i++)
{
if (g_strcmp0 (ipp_choice_translations[i].keyword, option) == 0 &&
- g_strcmp0 (ipp_choice_translations[i].choice, choice) == 0)
- return _(ipp_choice_translations[i].translation);
+ g_strcmp0 (ipp_choice_translations[i].choice, choice) == 0)
+ {
+ return _(ipp_choice_translations[i].translation);
+ }
}
return choice;
@@ -158,101 +160,68 @@ pp_ipp_option_widget_new (IPPAttribute *attr_supported,
return (GtkWidget *) self;
}
-enum {
- NAME_COLUMN,
- VALUE_COLUMN,
- N_COLUMNS
-};
-
static GtkWidget *
-combo_box_new (void)
+dropdown_new (void)
{
- GtkCellRenderer *cell;
- g_autoptr(GtkListStore) store = NULL;
- GtkWidget *combo_box;
-
- combo_box = gtk_combo_box_new ();
+ GtkStringList *store = NULL;
+ GtkWidget *dropdown;
- store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
+ store = gtk_string_list_new (NULL);
- cell = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
- "text", NAME_COLUMN,
- NULL);
+ dropdown = gtk_drop_down_new (G_LIST_MODEL (store), NULL);
- return combo_box;
+ return dropdown;
}
static void
-combo_box_append (GtkWidget *combo,
- const gchar *display_text,
- const gchar *value)
+dropdown_append (GtkWidget *dropdown,
+ const gchar *display_text)
{
- GtkTreeModel *model;
- GtkListStore *store;
- GtkTreeIter iter;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
- store = GTK_LIST_STORE (model);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- NAME_COLUMN, display_text,
- VALUE_COLUMN, value,
- -1);
-}
+ GtkStringList *store;
-struct ComboSet {
- GtkComboBox *combo;
- const gchar *value;
-};
+ store = GTK_STRING_LIST (gtk_drop_down_get_model (GTK_DROP_DOWN (dropdown)));
-static gboolean
-set_cb (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
-{
- struct ComboSet *set_data = data;
- g_autofree gchar *value = NULL;
-
- gtk_tree_model_get (model, iter, VALUE_COLUMN, &value, -1);
- if (strcmp (value, set_data->value) == 0)
- {
- gtk_combo_box_set_active_iter (set_data->combo, iter);
- return TRUE;
- }
-
- return FALSE;
+ gtk_string_list_append (store, display_text);
}
static void
-combo_box_set (GtkWidget *combo,
- const gchar *value)
+dropdown_set (GtkWidget *dropdown,
+ IPPAttribute *option,
+ const gchar *value)
{
- struct ComboSet set_data;
- GtkTreeModel *model;
+ g_autofree gchar *attribute_value = NULL;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+ for (guint i = 0; i < option->num_of_values; i++)
+ {
+ if (option->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
+ attribute_value = g_strdup_printf ("%d", option->attribute_values[i].integer_value);
+ else
+ attribute_value = g_strdup (option->attribute_values[i].string_value);
- set_data.combo = GTK_COMBO_BOX (combo);
- set_data.value = value;
- gtk_tree_model_foreach (model, set_cb, &set_data);
+ if (g_strcmp0 (attribute_value, value) == 0)
+ {
+ gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), i);
+ break;
+ }
+ }
}
static char *
-combo_box_get (GtkWidget *combo)
+dropdown_get (GtkWidget *dropdown,
+ IPPAttribute *option)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- gchar *value = NULL;
+ guint selected_item;
+ gchar *value = NULL;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+ selected_item = gtk_drop_down_get_selected (GTK_DROP_DOWN (dropdown));
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))
- gtk_tree_model_get (model, &iter, VALUE_COLUMN, &value, -1);
+ if (selected_item != GTK_INVALID_LIST_POSITION)
+ {
+ if (option->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
+ value = g_strdup_printf ("%d", option->attribute_values[selected_item].integer_value);
+ else
+ value = option->attribute_values[selected_item].string_value;
+ }
return value;
}
@@ -295,12 +264,12 @@ switch_changed_cb (PpIPPOptionWidget *self)
}
static void
-combo_changed_cb (PpIPPOptionWidget *self)
+dropdown_changed_cb (PpIPPOptionWidget *self)
{
gchar **values;
values = g_new0 (gchar *, 2);
- values[0] = combo_box_get (self->combo);
+ values[0] = g_strdup (dropdown_get (self->dropdown, self->option_supported));
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
@@ -380,34 +349,32 @@ construct_widget (PpIPPOptionWidget *self)
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- self->combo = combo_box_new ();
+ self->dropdown = dropdown_new ();
for (i = 0; i < self->option_supported->num_of_values; i++)
{
g_autofree gchar *value = NULL;
value = g_strdup_printf ("%d", self->option_supported->attribute_values[i].integer_value);
- combo_box_append (self->combo,
- ipp_choice_translate (self->option_name,
- value),
- value);
+ dropdown_append (self->dropdown,
+ ipp_choice_translate (self->option_name,
+ value));
}
- gtk_box_append (GTK_BOX (self), self->combo);
- g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self, G_CONNECT_SWAPPED);
+ gtk_box_append (GTK_BOX (self), self->dropdown);
+ g_signal_connect_object (self->dropdown, "notify::selected", G_CALLBACK (dropdown_changed_cb), self, G_CONNECT_SWAPPED);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- self->combo = combo_box_new ();
+ self->dropdown = dropdown_new ();
for (i = 0; i < self->option_supported->num_of_values; i++)
- combo_box_append (self->combo,
- ipp_choice_translate (self->option_name,
- self->option_supported->attribute_values[i].string_value),
- self->option_supported->attribute_values[i].string_value);
+ dropdown_append (self->dropdown,
+ ipp_choice_translate (self->option_name,
+ self->option_supported->attribute_values[i].string_value));
- gtk_box_append (GTK_BOX (self), self->combo);
- g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self, G_CONNECT_SWAPPED);
+ gtk_box_append (GTK_BOX (self), self->dropdown);
+ g_signal_connect_object (self->dropdown, "notify::selected", G_CALLBACK (dropdown_changed_cb), self, G_CONNECT_SWAPPED);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
@@ -468,37 +435,37 @@ update_widget_real (PpIPPOptionWidget *self)
break;
case IPP_ATTRIBUTE_TYPE_INTEGER:
- g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_block_by_func (self->dropdown, dropdown_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_INTEGER)
{
g_autofree gchar *value = g_strdup_printf ("%d", attr->attribute_values[0].integer_value);
- combo_box_set (self->combo, value);
+ dropdown_set (self->dropdown, self->option_supported, value);
}
else
{
g_autofree gchar *value = g_strdup_printf ("%d", self->option_supported->attribute_values[0].integer_value);
- combo_box_set (self->combo, value);
+ dropdown_set (self->dropdown, self->option_supported, value);
}
- g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_unblock_by_func (self->dropdown, dropdown_changed_cb, self);
break;
case IPP_ATTRIBUTE_TYPE_STRING:
- g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_block_by_func (self->dropdown, dropdown_changed_cb, self);
if (attr && attr->num_of_values > 0 &&
attr->attribute_type == IPP_ATTRIBUTE_TYPE_STRING)
{
- combo_box_set (self->combo, attr->attribute_values[0].string_value);
+ dropdown_set (self->dropdown, self->option_supported, attr->attribute_values[0].string_value);
}
else
{
- combo_box_set (self->combo, self->option_supported->attribute_values[0].string_value);
+ dropdown_set (self->dropdown, self->option_supported, self->option_supported->attribute_values[0].string_value);
}
- g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_unblock_by_func (self->dropdown, dropdown_changed_cb, self);
break;
case IPP_ATTRIBUTE_TYPE_RANGE:
diff --git a/panels/printers/pp-ppd-option-widget.c b/panels/printers/pp-ppd-option-widget.c
index 2f3962090..0375b16cb 100644
--- a/panels/printers/pp-ppd-option-widget.c
+++ b/panels/printers/pp-ppd-option-widget.c
@@ -40,7 +40,7 @@ struct _PpPPDOptionWidget
GtkBox parent_instance;
GtkWidget *switch_button;
- GtkWidget *combo;
+ GtkWidget *dropdown;
GtkWidget *image;
GtkWidget *box;
@@ -180,8 +180,10 @@ ppd_choice_translate (ppd_choice_t *choice)
for (i = 0; i < G_N_ELEMENTS (ppd_choice_translations); i++)
{
if (g_strcmp0 (ppd_choice_translations[i].keyword, keyword) == 0 &&
- g_strcmp0 (ppd_choice_translations[i].choice, choice->choice) == 0)
- return _(ppd_choice_translations[i].translation);
+ g_strcmp0 (ppd_choice_translations[i].choice, choice->choice) == 0)
+ {
+ return _(ppd_choice_translations[i].translation);
+ }
}
return choice->text;
@@ -216,102 +218,58 @@ pp_ppd_option_widget_new (ppd_option_t *option,
return (GtkWidget *) self;
}
-enum {
- NAME_COLUMN,
- VALUE_COLUMN,
- N_COLUMNS
-};
-
static GtkWidget *
-combo_box_new (void)
+dropdown_new (void)
{
- GtkCellRenderer *cell;
- g_autoptr(GtkListStore) store = NULL;
- GtkWidget *combo_box;
+ GtkStringList *store = NULL;
+ GtkWidget *dropdown;
- combo_box = gtk_combo_box_new ();
+ store = gtk_string_list_new (NULL);
- store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
+ dropdown = gtk_drop_down_new (G_LIST_MODEL (store), NULL);
- cell = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
- "text", NAME_COLUMN,
- NULL);
-
- return combo_box;
+ return dropdown;
}
static void
-combo_box_append (GtkWidget *combo,
- const gchar *display_text,
- const gchar *value)
-{
- GtkTreeModel *model;
- GtkListStore *store;
- GtkTreeIter iter;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
- store = GTK_LIST_STORE (model);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- NAME_COLUMN, display_text,
- VALUE_COLUMN, value,
- -1);
-}
-
-struct ComboSet {
- GtkComboBox *combo;
- const gchar *value;
-};
-
-static gboolean
-set_cb (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
+dropdown_append (GtkWidget *dropdown,
+ const gchar *display_text)
{
- struct ComboSet *set_data = data;
- g_autofree gchar *value = NULL;
+ GtkStringList *store;
- gtk_tree_model_get (model, iter, VALUE_COLUMN, &value, -1);
+ store = GTK_STRING_LIST (gtk_drop_down_get_model (GTK_DROP_DOWN (dropdown)));
- if (strcmp (value, set_data->value) == 0)
- {
- gtk_combo_box_set_active_iter (set_data->combo, iter);
- return TRUE;
- }
-
- return FALSE;
+ gtk_string_list_append (store, display_text);
}
static void
-combo_box_set (GtkWidget *combo,
- const gchar *value)
+dropdown_set (GtkWidget *dropdown,
+ ppd_option_t *option,
+ const gchar *value)
{
- struct ComboSet set_data;
- GtkTreeModel *model;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
-
- set_data.combo = GTK_COMBO_BOX (combo);
- set_data.value = value;
- gtk_tree_model_foreach (model, set_cb, &set_data);
+ for (guint i = 0; i < option->num_choices; i++)
+ {
+ if (g_strcmp0 (option->choices[i].choice, value) == 0)
+ {
+ gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), i);
+ break;
+ }
+ }
}
static char *
-combo_box_get (GtkWidget *combo)
+dropdown_get (GtkWidget *dropdown,
+ ppd_option_t *option)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- gchar *value = NULL;
+ guint selected_item;
+ gchar *value = NULL;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+ selected_item = gtk_drop_down_get_selected (GTK_DROP_DOWN (dropdown));
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))
- gtk_tree_model_get (model, &iter, VALUE_COLUMN, &value, -1);
+ if (selected_item != GTK_INVALID_LIST_POSITION)
+ {
+ value = option->choices[selected_item].choice;
+ }
return value;
}
@@ -354,12 +312,12 @@ switch_changed_cb (PpPPDOptionWidget *self)
}
static void
-combo_changed_cb (PpPPDOptionWidget *self)
+dropdown_changed_cb (PpPPDOptionWidget *self)
{
gchar **values;
values = g_new0 (gchar *, 2);
- values[0] = combo_box_get (self->combo);
+ values[0] = g_strdup (dropdown_get (self->dropdown, self->option));
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
@@ -394,31 +352,29 @@ construct_widget (PpPPDOptionWidget *self)
break;
case PPD_UI_PICKONE:
- self->combo = combo_box_new ();
+ self->dropdown = dropdown_new ();
for (i = 0; i < self->option->num_choices; i++)
{
- combo_box_append (self->combo,
- ppd_choice_translate (&self->option->choices[i]),
- self->option->choices[i].choice);
+ dropdown_append (self->dropdown,
+ ppd_choice_translate (&self->option->choices[i]));
}
- gtk_box_append (GTK_BOX (self), self->combo);
- g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self, G_CONNECT_SWAPPED);
+ gtk_box_append (GTK_BOX (self), self->dropdown);
+ g_signal_connect_object (self->dropdown, "notify::selected", G_CALLBACK (dropdown_changed_cb), self, G_CONNECT_SWAPPED);
break;
case PPD_UI_PICKMANY:
- self->combo = combo_box_new ();
+ self->dropdown = dropdown_new ();
for (i = 0; i < self->option->num_choices; i++)
{
- combo_box_append (self->combo,
- ppd_choice_translate (&self->option->choices[i]),
- self->option->choices[i].choice);
+ dropdown_append (self->dropdown,
+ ppd_choice_translate (&self->option->choices[i]));
}
- gtk_box_append (GTK_BOX (self), self->combo);
- g_signal_connect_object (self->combo, "changed", G_CALLBACK (combo_changed_cb), self, G_CONNECT_SWAPPED);
+ gtk_box_append (GTK_BOX (self), self->dropdown);
+ g_signal_connect_object (self->dropdown, "notify::selected", G_CALLBACK (dropdown_changed_cb), self, G_CONNECT_SWAPPED);
break;
default:
@@ -445,13 +401,7 @@ update_widget_real (PpPPDOptionWidget *self)
ppd_file_t *ppd_file;
gint i;
- if (self->option)
- {
- option = cups_option_copy (self->option);
- cups_option_free (self->option);
- self->option = NULL;
- }
- else if (self->ppd_filename)
+ if (self->ppd_filename_set && self->ppd_filename)
{
ppd_file = ppdOpenFile (self->ppd_filename);
ppdLocalize (ppd_file);
@@ -464,7 +414,8 @@ update_widget_real (PpPPDOptionWidget *self)
{
if (g_str_equal (iter->keyword, self->option_name))
{
- option = cups_option_copy (iter);
+ g_clear_pointer (&self->option, cups_option_free);
+ self->option = cups_option_copy (iter);
break;
}
}
@@ -477,6 +428,8 @@ update_widget_real (PpPPDOptionWidget *self)
self->ppd_filename = NULL;
}
+ option = self->option;
+
if (option)
{
g_autofree gchar *value = NULL;
@@ -502,15 +455,15 @@ update_widget_real (PpPPDOptionWidget *self)
break;
case PPD_UI_PICKONE:
- g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
- combo_box_set (self->combo, value);
- g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_block_by_func (self->dropdown, dropdown_changed_cb, self);
+ dropdown_set (self->dropdown, option, value);
+ g_signal_handlers_unblock_by_func (self->dropdown, dropdown_changed_cb, self);
break;
case PPD_UI_PICKMANY:
- g_signal_handlers_block_by_func (self->combo, combo_changed_cb, self);
- combo_box_set (self->combo, value);
- g_signal_handlers_unblock_by_func (self->combo, combo_changed_cb, self);
+ g_signal_handlers_block_by_func (self->dropdown, dropdown_changed_cb, self);
+ dropdown_set (self->dropdown, option, value);
+ g_signal_handlers_unblock_by_func (self->dropdown, dropdown_changed_cb, self);
break;
default:
@@ -523,8 +476,6 @@ update_widget_real (PpPPDOptionWidget *self)
else
gtk_widget_hide (self->image);
}
-
- cups_option_free (option);
}
static void
--
GitLab

View File

@ -1 +1 @@
SHA512 (gnome-control-center-42.0.tar.xz) = d8097240444ab45174e89db0f543d6523051829b124933cdbb84b1bc5d2d6809ee810f6d2c09702da51c991fe11496635b3164b490ed1e2ac523481d5466cf3e
SHA512 (gnome-control-center-42.1.tar.xz) = a29df2604d90e42a602060a7042d70238eed9e59c46b500610c6b5842e015ba0d9567528a3dfd6bf365973f274de47ccd4b8f2f50cfa35c8f88bb05cb31e774d