This commit is contained in:
songnannan 2019-12-29 16:48:42 +08:00
parent 64be36fe4d
commit b76eb1e4c8
8 changed files with 581 additions and 0 deletions

View File

@ -0,0 +1,94 @@
From 10b064844855a3d0ce4cefb5c8d02eab7e0d2d6a Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Thu, 4 Oct 2018 11:28:15 +0200
Subject: [PATCH] online-accounts: Track the lifecycle of CcGoaPanel across
async calls
Due to an API bug in GNOME Online Accounts, the asynchronous
goa_provider_get_all method doesn't accept a GCancellable argument.
This makes it difficult to cancel an ongoing call when the CcGoaPanel
gets destroyed.
Prior to commit c26f8ae018900a55, this was hacked around by taking a
reference on the panel for the duration of the call. Instead of
cancelling a pending call on destruction, it would keep the panel alive
until the call was over. However, that was lost during commit
c26f8ae018900a55.
One thing to bear in mind is that GtkWidgets, CcGoaPanel is one, can
be destroyed by a gtk_widget_destroy call, which is subtly different
than a simple sequence of g_object_unref calls. When gtk_widget_destroy
is used, it invokes the GObject::dispose virtual method of the widget.
It is expected this will cause anything holding a reference to this
widget to drop their references, leading to GObject::finalize being
called. However, there is no guarantee that this will happen in the
same iteration of the GMainLoop. Therefore, it is possible that when
the goa_provider_get_all call finishes, the CcGoaPanel might be in a
disposed, but not yet finalized state.
When a GObject is in a disposed-but-not-finalized state, only a very
limited number of operations can be performed on it. Its reference
count can be altered, the memory used by the instance struct can be
accessed, but none of the member GObjects can be assumed to be valid.
eg., it's definitely illegal to add new rows to the member GtkListBox.
Hence a boolean flag is used to mark the destroyed state of the panel.
This second part is a small improvement over the earlier hack.
https://gitlab.gnome.org/GNOME/gnome-control-center/issues/208
---
panels/online-accounts/cc-online-accounts-panel.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/panels/online-accounts/cc-online-accounts-panel.c b/panels/online-accounts/cc-online-accounts-panel.c
index a89d249c0..747381bef 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -56,6 +56,7 @@ struct _CcGoaPanel
GtkWidget *stack;
GtkWidget *accounts_vbox;
+ gboolean destroyed;
guint remove_account_timeout_id;
};
@@ -394,6 +395,8 @@ cc_goa_panel_dispose (GObject *object)
/* Must be destroyed in dispose, not finalize. */
g_clear_pointer (&panel->edit_account_dialog, gtk_widget_destroy);
+ panel->destroyed = TRUE;
+
G_OBJECT_CLASS (cc_goa_panel_parent_class)->dispose (object);
}
@@ -489,7 +492,7 @@ cc_goa_panel_init (CcGoaPanel *panel)
panel);
fill_accounts_listbox (panel);
- goa_provider_get_all (get_all_providers_cb, panel);
+ goa_provider_get_all (get_all_providers_cb, g_object_ref_sink (panel));
gtk_widget_show (GTK_WIDGET (panel));
}
@@ -852,7 +855,7 @@ get_all_providers_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
- CcGoaPanel *self = user_data;
+ g_autoptr (CcGoaPanel) self = user_data;
GList *providers;
GList *l;
@@ -860,6 +863,9 @@ get_all_providers_cb (GObject *source,
if (!goa_provider_get_all_finish (&providers, res, NULL))
return;
+ if (self->destroyed)
+ return;
+
for (l = providers; l != NULL; l = l->next)
{
GoaProvider *provider;
--
2.19.0

View File

@ -0,0 +1,232 @@
From d8a9c8c3526980e576e8d61d033cd983562b07d3 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Mon, 1 Oct 2018 20:36:05 +0200
Subject: [PATCH] background: Add queue to load 4 pictures at a time
We need to process the pictures sequentially rather than trying to
thumbnail all of them in parallel. This commit adds a simple task queue
from which 4 tasks at will be processed at the same time.
Fixes #191
---
panels/background/bg-pictures-source.c | 128 ++++++++++++++++++++++++-
1 file changed, 123 insertions(+), 5 deletions(-)
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index a37682d63..2e43ae84a 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -47,12 +47,26 @@ struct _BgPicturesSource
GnomeDesktopThumbnailFactory *thumb_factory;
+ GQueue add_queue;
+ gint adds_running;
+
GFileMonitor *picture_dir_monitor;
GFileMonitor *cache_dir_monitor;
GHashTable *known_items;
};
+#define MAX_PARALLEL_ADD 4
+
+typedef struct {
+ BgPicturesSource *bg_source;
+ GFile *file;
+ gchar *content_type;
+ guint64 mtime;
+ GtkTreeRowReference **ret_row_ref;
+ GCancellable *cancellable;
+} AddQueueData;
+
G_DEFINE_TYPE (BgPicturesSource, bg_pictures_source, BG_TYPE_SOURCE)
const char * const content_types[] = {
@@ -74,6 +88,86 @@ static char *bg_pictures_source_get_unique_filename (const char *uri);
static void picture_opened_for_read (GObject *source_object, GAsyncResult *res, gpointer user_data);
+static gboolean add_single_file_real (BgPicturesSource *bg_source,
+ GFile *file,
+ const gchar *content_type,
+ guint64 mtime,
+ GtkTreeRowReference **ret_row_ref);
+
+static void
+add_queue_data_free (AddQueueData *data)
+{
+ g_clear_object (&data->file);
+ g_clear_object (&data->cancellable);
+ g_free (data->content_type);
+ g_free (data);
+}
+
+static gboolean
+add_single_file_idle (gpointer user_data)
+{
+ AddQueueData *data = (AddQueueData*) user_data;
+
+ if (!g_cancellable_is_cancelled (data->cancellable))
+ add_single_file_real (data->bg_source, data->file, data->content_type,
+ data->mtime, data->ret_row_ref);
+ add_queue_data_free (data);
+
+ return FALSE;
+}
+
+static void
+ensure_add_processing (BgPicturesSource *bg_source)
+{
+ while (bg_source->adds_running < MAX_PARALLEL_ADD)
+ {
+ AddQueueData *data = g_queue_pop_head (&bg_source->add_queue);
+
+ /* Nothing left to process */
+ if (!data)
+ return;
+
+ g_idle_add (add_single_file_idle, data);
+
+ bg_source->adds_running += 1;
+ }
+}
+
+static void
+add_processing_finished (BgPicturesSource *bg_source)
+{
+ g_assert (bg_source->adds_running > 0);
+
+ bg_source->adds_running -= 1;
+
+ ensure_add_processing (bg_source);
+}
+
+static gboolean
+add_single_file (BgPicturesSource *bg_source,
+ GFile *file,
+ const gchar *content_type,
+ guint64 mtime,
+ GtkTreeRowReference **ret_row_ref)
+{
+ AddQueueData *data = g_new0 (AddQueueData, 1);
+
+ data->bg_source = bg_source;
+ data->file = g_object_ref (file);
+ data->content_type = g_strdup (content_type);
+ data->mtime = mtime;
+ data->ret_row_ref = ret_row_ref;
+ data->cancellable = g_object_ref (bg_source->cancellable);
+
+ g_queue_push_tail (&bg_source->add_queue, data);
+
+ ensure_add_processing (bg_source);
+
+ /* Just return TRUE. */
+ return TRUE;
+}
+
+
static void
bg_pictures_source_dispose (GObject *object)
{
@@ -85,6 +179,9 @@ bg_pictures_source_dispose (GObject *object)
g_clear_object (&source->cancellable);
}
+ g_queue_foreach (&source->add_queue, (GFunc) add_queue_data_free, NULL);
+ g_queue_clear (&source->add_queue);
+
g_clear_object (&source->grl_miner);
g_clear_object (&source->thumb_factory);
@@ -190,6 +287,9 @@ picture_scaled (GObject *source_object,
{
g_warning ("Failed to load image: %s", error->message);
remove_placeholder (BG_PICTURES_SOURCE (user_data), item);
+
+ bg_source = BG_PICTURES_SOURCE (user_data);
+ add_processing_finished (bg_source);
}
return;
@@ -211,6 +311,8 @@ picture_scaled (GObject *source_object,
{
g_debug ("Ignored URL '%s' as it's a screenshot from gnome-screenshot", uri);
remove_placeholder (BG_PICTURES_SOURCE (user_data), item);
+
+ add_processing_finished (bg_source);
return;
}
@@ -264,6 +366,8 @@ picture_scaled (GObject *source_object,
GINT_TO_POINTER (TRUE));
g_clear_pointer (&surface, (GDestroyNotify) cairo_surface_destroy);
+
+ add_processing_finished (bg_source);
}
static void
@@ -288,6 +392,9 @@ picture_opened_for_read (GObject *source_object,
g_autofree gchar *filename = g_file_get_path (G_FILE (source_object));
g_warning ("Failed to load picture '%s': %s", filename, error->message);
remove_placeholder (BG_PICTURES_SOURCE (user_data), item);
+
+ bg_source = BG_PICTURES_SOURCE (user_data);
+ add_processing_finished (bg_source);
}
return;
@@ -341,6 +448,10 @@ picture_copied_for_read (GObject *source_object,
uri = g_file_get_uri (thumbnail_file);
g_warning ("Failed to download '%s': %s", uri, error->message);
+
+ bg_source = BG_PICTURES_SOURCE (user_data);
+ add_processing_finished (bg_source);
+
return;
}
}
@@ -441,11 +552,11 @@ bg_pictures_source_get_cache_file (void)
}
static gboolean
-add_single_file (BgPicturesSource *bg_source,
- GFile *file,
- const gchar *content_type,
- guint64 mtime,
- GtkTreeRowReference **ret_row_ref)
+add_single_file_real (BgPicturesSource *bg_source,
+ GFile *file,
+ const gchar *content_type,
+ guint64 mtime,
+ GtkTreeRowReference **ret_row_ref)
{
g_autoptr(CcBackgroundItem) item = NULL;
CcBackgroundItemFlags flags = 0;
@@ -573,6 +684,11 @@ add_single_file (BgPicturesSource *bg_source,
}
gtk_tree_path_free (path);
g_clear_pointer (&surface, (GDestroyNotify) cairo_surface_destroy);
+
+ /* Async processing is happening. */
+ if (!retval)
+ add_processing_finished (bg_source);
+
return retval;
}
@@ -955,6 +1071,8 @@ bg_pictures_source_init (BgPicturesSource *self)
(GDestroyNotify) g_free,
NULL);
+ g_queue_init (&self->add_queue);
+
pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
if (pictures_path == NULL)
pictures_path = g_get_home_dir ();
--
2.19.0

View File

@ -0,0 +1,52 @@
diff -Nur gnome-control-center-3.26.2.old/panels/user-accounts/run-passwd.c gnome-control-center-3.26.2/panels/user-accounts/run-passwd.c
--- gnome-control-center-3.26.2.old/panels/user-accounts/run-passwd.c 2018-10-27 19:31:31.154224814 +0000
+++ gnome-control-center-3.26.2/panels/user-accounts/run-passwd.c 2018-10-27 19:34:58.394200706 +0000
@@ -469,7 +469,7 @@
"different",
"wrapped",
"recovered",
- "recent",
+ "already used",
"unchanged",
"match",
"1 numeric or special",
@@ -512,9 +512,9 @@
strstr (str->str, "wrapped") != NULL) {
error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
_("The old and new passwords are too similar"));
- } else if (strstr (str->str, "recent") != NULL) {
+ } else if (strstr (str->str, "already used") != NULL) {
error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
- _("The new password has already been used recently."));
+ _("Password has been already used. Choose another."));
} else if (strstr (str->str, "1 numeric or special") != NULL) {
error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
_("The new password must contain numeric or special characters"));
diff -Nur gnome-control-center-3.26.2.old/panels/user-accounts/um-password-dialog.c gnome-control-center-3.26.2/panels/user-accounts/um-password-dialog.c
--- gnome-control-center-3.26.2.old/panels/user-accounts/um-password-dialog.c 2018-10-27 19:31:31.154224814 +0000
+++ gnome-control-center-3.26.2/panels/user-accounts/um-password-dialog.c 2018-10-27 19:36:35.291189435 +0000
@@ -143,8 +143,9 @@
primary_text = error->message;
secondary_text = _("Please choose another password.");
+ gtk_entry_set_text (GTK_ENTRY (um->old_password_entry), "");
+ gtk_widget_grab_focus (um->old_password_entry);
gtk_entry_set_text (GTK_ENTRY (um->password_entry), "");
- gtk_widget_grab_focus (um->password_entry);
gtk_entry_set_text (GTK_ENTRY (um->verify_entry), "");
}
diff -Nur gnome-control-center-3.26.2.old/po/zh_CN.po gnome-control-center-3.26.2/po/zh_CN.po
--- gnome-control-center-3.26.2.old/po/zh_CN.po 2018-10-27 19:31:31.070224824 +0000
+++ gnome-control-center-3.26.2/po/zh_CN.po 2018-10-27 19:38:13.743177982 +0000
@@ -6401,8 +6401,8 @@
#: ../panels/user-accounts/run-passwd.c:517
#, c-format
-msgid "The new password has already been used recently."
-msgstr "新的密码最近已使用过。"
+msgid "Password has been already used. Choose another."
+msgstr "新密码在最近已经使用过。请选用其他密码"
#: ../panels/user-accounts/run-passwd.c:520
#, c-format

View File

@ -0,0 +1,28 @@
diff -Nur gnome-control-center-3.14.5_orig/panels/universal-access/uap.ui gnome-control-center-3.14.5/panels/universal-access/uap.ui
--- gnome-control-center-3.14.5_orig/panels/universal-access/uap.ui 2017-05-23 21:59:10.676257462 +0800
+++ gnome-control-center-3.14.5/panels/universal-access/uap.ui 2017-05-23 22:31:42.502077833 +0800
@@ -1868,6 +1868,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">click_delay_adjustment</property>
+ <property name="width_request">200</property>
<property name="draw_value">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="pointing_secondary_click_delay_scale-atkobject">
@@ -2033,6 +2034,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">dwell_time_adjustment</property>
+ <property name="width_request">200</property>
<property name="draw_value">False</property>
<property name="value_pos">right</property>
</object>
@@ -2122,6 +2124,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">dwell_threshold_adjustment</property>
+ <property name="width_request">200</property>
<property name="digits">0</property>
<property name="draw_value">False</property>
</object>

View File

@ -0,0 +1,12 @@
diff -Nur gnome-control-center-3.30.1.bak/panels/background/bg-wallpapers-source.c gnome-control-center-3.30.1/panels/background/bg-wallpapers-source.c
--- gnome-control-center-3.30.1.bak/panels/background/bg-wallpapers-source.c 2019-01-23 07:15:34.793000000 -0500
+++ gnome-control-center-3.30.1/panels/background/bg-wallpapers-source.c 2019-01-23 07:16:16.286000000 -0500
@@ -126,7 +126,7 @@
G_CALLBACK (item_added), self);
/* Try adding the default background first */
- load_default_bg (self);
+ //load_default_bg (self);
cc_background_xml_load_list_async (self->xml, NULL, list_load_cb, self);
}

Binary file not shown.

View File

@ -0,0 +1,25 @@
--- a/panels/user-accounts/pw-utils.c 2015-03-17 07:25:21.000000000 -0400
+++ b/panels/user-accounts/pw-utils.c 2018-03-15 06:09:58.370000000 -0400
@@ -114,7 +114,7 @@
case PWQ_ERROR_MIN_LENGTH:
return C_("Password hint", "Password needs to be longer. Try to add more letters, numbers and punctuation.");
case PWQ_ERROR_EMPTY_PASSWORD:
- return C_("Password hint", "Mix uppercase and lowercase and try to use a number or two.");
+ return C_("Password hint", "Mix at least three types of these: lower and upper case letters, digits and any of characters.");
default:
return C_("Password hint", "Adding more letters, numbers and punctuation will make the password stronger.");
}
--- a/po/zh_CN.po 2018-03-15 06:03:27.989000000 -0400
+++ a/po/zh_CN.po 2018-03-15 06:17:13.478000000 -0400
@@ -6200,8 +6200,8 @@
#: ../panels/user-accounts/pw-utils.c:117
msgctxt "Password hint"
-msgid "Mix uppercase and lowercase and try to use a number or two."
-msgstr "密码需要大小写字母混用并试着使用一到两个数字。"
+msgid "Mix at least three types of these: lower and upper case letters, digits and any of characters."
+msgstr "混合至少三种类型:大写字母,小写字母,数字和特殊字符。"
#: ../panels/user-accounts/pw-utils.c:119
msgctxt "Password hint"

138
gnome-control-center.spec Normal file
View File

@ -0,0 +1,138 @@
Name: gnome-control-center
Version: 3.30.1
Release: 6
Summary: GNOME Settings is GNOME's main interface for configuration of various aspects of your desktop.
License: GPLv2+ and CC-BY-SA
URL: http://www.gnome.org
Source0: https://github.com/GNOME/gnome-control-center/releases/tag/%{name}-%{version}.tar.xz
BuildRequires: chrpath cups-devel desktop-file-utils docbook-style-xsl gettext libXxf86misc-devel
BuildRequires: libxslt meson accountsservice-devel cheese-libs-devel clutter-gtk-devel colord-devel
BuildRequires: colord-gtk-devel gdk-pixbuf2-devel gtk3-devel glib2-devel pulseaudio-libs-devel
BuildRequires: gnome-desktop3-devel gnome-settings-daemon-devel gnome-online-accounts-devel
BuildRequires: grilo-devel gsettings-desktop-schemas-devel gtk3-devel libgudev-devel ibus-devel
BuildRequires: libcanberra-devel libgtop2-devel NetworkManager-libnm-devel libnma-devel
BuildRequires: libsecret-devel libsoup-devel libxml2-devel ModemManager-glib-devel polkit-devel
BuildRequires: libpwquality-devel libsmbclient-devel upower-devel libX11-devel libXi-devel
BuildRequires: gnome-bluetooth-libs-devel libwacom-devel
Requires: accountsservice alsa-lib bolt colord cups-pk-helper dbus-x11 glx-utils iso-codes
Requires: nm-connection-editor switcheroo-control /usr/bin/gkbd-keyboard-display
Requires: gnome-bluetooth >= 1:3.18.2 %{name}-filesystem = %{version}-%{release}
Requires: upower >= 0.99.6 cheese-libs >= 3.28.0 glib2 >= 2.53.0 gtk3 >= 3.22.20
Requires: gnome-online-accounts >= 3.25.3 gnome-settings-daemon >= 3.25.90
Requires: gsettings-desktop-schemas >= 3.27.2 gnome-desktop3 >= 3.27.90
Recommends: NetworkManager-wifi vino
Provides: control-center = 1:%{version}-%{release}
Provides: control-center%{?_isa} = 1:%{version}-%{release}
Obsoletes: control-center < 1:%{version}-%{release}
# Patch0 and Patch2 is from fedora 29
Patch1: 0001-online-accounts-Track-the-lifecycle-of-CcGoaPanel-ac.patch
Patch2: 0002-background-Add-queue-to-load-4-pictures-at-a-time.patch
Patch9000: bugfix-gnome-control-center-clickassist-fix.patch
Patch9001: bugfix-gnome-control-center-fix-repetitivewallpapers.patch
Patch9002: bugfix-fix_used_passwd_error_capture.patch
Patch9003: gnome-control-center-change-translation-when-changing-password.patch
%description
Gnome-control-center is a graphical user interface to configure
various aspects of GNOME.
The configuration files that are picked up by the control-center
utilities are installed in directories contained by this package
%package filesystem
Summary: Directories for %{name}
BuildArch: noarch
Provides: control-center-filesystem = 1:%{version}-%{release}
Obsoletes: control-center-filesystem < 1:%{version}-%{release}
%description filesystem
The %{name}-filesystem contains directories where applications can
install configuration files that are picked up by the control-center
utilities in this package.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
%build
%meson -Ddocumentation=true
%meson_build
%install
%meson_install
mkdir -p %{buildroot}%{_datadir}/gnome/wm-properties
%find_lang %{name} --all-name --with-gnome
chrpath --delete %{buildroot}%{_bindir}/gnome-control-center
%files -f %{name}.lang
%license COPYING
%{_bindir}/gnome-control-center
%{_libexecdir}/gnome-control-center-search-provider
%{_libexecdir}/cc-remote-login-helper
%{_datadir}/sounds/gnome/default/alerts/*.ogg
%{_datadir}/polkit-1/actions/*.policy
%{_datadir}/polkit-1/rules.d/gnome-control-center.rules
%{_datadir}/pixmaps/faces/
%{_datadir}/pkgconfig/*.pc
%{_datadir}/icons/hicolor/*
%{_datadir}/metainfo/*.xml
%{_datadir}/gnome-control-center/*
%{_datadir}/gnome-shell/search-providers/*.ini
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/gettext/its/*
%{_datadir}/dbus-1/services/*.service
%{_datadir}/bash-completion/completions/gnome-control-center
%{_datadir}/applications/*.desktop
%files filesystem
%dir %{_datadir}/gnome/wm-properties
%dir %{_datadir}/gnome-control-center/sounds
%dir %{_datadir}/gnome-control-center/keybindings
%files help
%doc NEWS README.md
%{_mandir}/man1/*.gz
%changelog
* Sat Dec 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.1-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:optimization the spec
* Sat Sep 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.1-5
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:keep filesystem package
* Sat Aug 31 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.1-4
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add requires
* Thu Aug 22 2019 licunlong <licunlong@huawei.com> - 3.30.1-3.h2
- Type: NA
- ID: NA
- SUG: NA
- DESC: Remove patch prefix.
* Wed Jan 23 2019 gulining<gulining1@huawei.com> - 3.30.1-3.h1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:gnome control center clickassist fix
gnome control center fix repetitivewallpapers
fix used passwd error capture
gnome control center change translation when changing password
* Wed Oct 24 2018 openEuler Buildteam <buildteam@openeuler.org> - 3.30.1-2
- Package Init