Compare commits

..

No commits in common. "fe79a3bb4fc9d279adf59b5d0d3fb6249de8917a" and "87df142d55b67c9a41ddf789891e82739327c26a" have entirely different histories.

6 changed files with 18 additions and 542 deletions

View File

@ -1,461 +0,0 @@
From bc6db155617f44a194d1ff1035c3d8aaaa21aafc Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Wed, 28 Jun 2023 11:20:12 +0800
Subject: [PATCH] fix(disks):Fixed interface translation not displayed in
GB18030 coding
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复在GB18030编码下界面翻译不显示
Close #7250
---
src/disks/gdubenchmarkdialog.c | 3 ++-
src/disks/gducreateconfirmpage.c | 13 +++++++---
src/disks/gducreatediskimagedialog.c | 3 ++-
src/disks/gdudevicetreemodel.c | 24 +++++++++---------
src/disks/gdurestorediskimagedialog.c | 17 +++++++++----
src/disks/gduvolumegrid.c | 7 +++---
src/disks/gduwindow.c | 35 +++++++++++++++------------
src/libgdu/gduutils.c | 3 ++-
8 files changed, 65 insertions(+), 40 deletions(-)
diff --git a/src/disks/gdubenchmarkdialog.c b/src/disks/gdubenchmarkdialog.c
index e975614..3b87936 100644
--- a/src/disks/gdubenchmarkdialog.c
+++ b/src/disks/gdubenchmarkdialog.c
@@ -13,6 +13,7 @@
#include <gio/gunixfdlist.h>
#include <gio/gunixinputstream.h>
#include <gio/gunixoutputstream.h>
+#include <glib-2.0/gmodule.h>
#include <glib-unix.h>
#include <sys/ioctl.h>
@@ -827,7 +828,7 @@ update_dialog (DialogData *data)
/* disk / device label */
drive = udisks_client_get_drive_for_block (gdu_window_get_client (data->window), data->block);
info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
- gtk_label_set_text (GTK_LABEL (data->device_label), udisks_object_info_get_one_liner (info));
+ gtk_label_set_text (GTK_LABEL (data->device_label), g_locale_to_utf8(udisks_object_info_get_one_liner (info),-1, NULL, NULL, NULL));
g_free (s);
G_LOCK (bm_lock);
diff --git a/src/disks/gducreateconfirmpage.c b/src/disks/gducreateconfirmpage.c
index be98943..6378b65 100644
--- a/src/disks/gducreateconfirmpage.c
+++ b/src/disks/gducreateconfirmpage.c
@@ -10,6 +10,8 @@
#include <glib/gi18n.h>
+#include <glib-2.0/gmodule.h>
+
#include "gducreateconfirmpage.h"
struct _GduCreateConfirmPage
@@ -107,8 +109,12 @@ gdu_create_confirm_page_fill_confirmation (GduCreateConfirmPage *page)
* from UDisks, first is description, second the name:
* "Partition 1 of 32 GB Flash Disk — /dev/sdb1".
*/
- s1 = g_strdup_printf (_("%s — %s"), udisks_object_info_get_description (info),
- udisks_object_info_get_name (info));
+ const gchar * desc = g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL);
+ const gchar * name = g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL);
+
+ s1 = g_strdup_printf (_("%s — %s"), desc,
+ name);
+
gtk_label_set_text (priv->device_name_label, s1);
g_free (s1);
@@ -122,7 +128,8 @@ gdu_create_confirm_page_fill_confirmation (GduCreateConfirmPage *page)
{
gtk_widget_show (GTK_WIDGET (priv->used_label));
gtk_widget_show (GTK_WIDGET (priv->used_amount_label));
- s1 = udisks_client_get_size_for_display (priv->client, size - unused_space, FALSE, FALSE);
+ gchar *size_for_display = udisks_client_get_size_for_display (priv->client, size - unused_space, FALSE, FALSE);
+ s1 = g_locale_to_utf8(size_for_display, -1, NULL, NULL, NULL);
/* Translators: Disk usage in the format '3 GB (7%)', unit string comes from UDisks.
*/
s2 = g_strdup_printf (_("%s (%.1f%%)"), s1, 100.0 * (size - unused_space) / size);
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index 181b289..9deb5c1 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -16,6 +16,7 @@
#include <gio/gunixfdlist.h>
#include <gio/gunixinputstream.h>
#include <gio/gfiledescriptorbased.h>
+#include <glib-2.0/gmodule.h>
#include <glib-unix.h>
#include <sys/ioctl.h>
@@ -289,7 +290,7 @@ create_disk_image_populate (DialogData *data)
/* Source label */
info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
- gtk_label_set_text (GTK_LABEL (data->source_label), udisks_object_info_get_one_liner (info));
+ gtk_label_set_text (GTK_LABEL (data->source_label), g_locale_to_utf8(udisks_object_info_get_one_liner (info),-1, NULL, NULL, NULL));
g_clear_object (&info);
}
diff --git a/src/disks/gdudevicetreemodel.c b/src/disks/gdudevicetreemodel.c
index 2157276..d591dad 100644
--- a/src/disks/gdudevicetreemodel.c
+++ b/src/disks/gdudevicetreemodel.c
@@ -11,6 +11,7 @@
#include "config.h"
#include <glib/gi18n.h>
+#include <glib-2.0/gmodule.h>
#include "gdudevicetreemodel.h"
#include "gduapplication.h"
@@ -881,9 +882,9 @@ update_drive (GduDeviceTreeModel *model,
s = g_strdup_printf ("<span foreground=\"#ff0000\">%s</span>"
"%s"
"<small><span foreground=\"#ff0000\">%s%s</span></small>",
- udisks_object_info_get_description (info),
+ g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL),
model->flags & GDU_DEVICE_TREE_MODEL_FLAGS_ONE_LINE_NAME ? " — " : "\n",
- udisks_object_info_get_name (info),
+ g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL),
included_device_name != NULL ? included_device_name : "");
}
else
@@ -891,9 +892,9 @@ update_drive (GduDeviceTreeModel *model,
s = g_strdup_printf ("%s"
"%s"
"<small>%s%s</small>",
- udisks_object_info_get_description (info),
+ g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL),
model->flags & GDU_DEVICE_TREE_MODEL_FLAGS_ONE_LINE_NAME ? " — " : "\n",
- udisks_object_info_get_name (info),
+ g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL),
included_device_name != NULL ? included_device_name : "");
}
@@ -916,7 +917,7 @@ update_drive (GduDeviceTreeModel *model,
&iter,
GDU_DEVICE_TREE_MODEL_COLUMN_ICON, icon,
GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
- GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, udisks_object_info_get_sort_key (info),
+ GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, g_locale_to_utf8(udisks_object_info_get_sort_key (info),-1, NULL, NULL, NULL),
GDU_DEVICE_TREE_MODEL_COLUMN_WARNING, warning,
GDU_DEVICE_TREE_MODEL_COLUMN_JOBS_RUNNING, jobs_running,
GDU_DEVICE_TREE_MODEL_COLUMN_PULSE, pulse,
@@ -1114,7 +1115,7 @@ update_block (GduDeviceTreeModel *model,
loop = udisks_object_peek_loop (object);
size = udisks_block_get_size (block);
- size_str = udisks_client_get_size_for_display (model->client, size, FALSE, FALSE);
+ size_str = g_locale_to_utf8(udisks_client_get_size_for_display (model->client, size, FALSE, FALSE) , -1, NULL, NULL, NULL);
info = udisks_client_get_object_info (model->client, object);
@@ -1127,7 +1128,7 @@ update_block (GduDeviceTreeModel *model,
s = g_strdup_printf ("%s"
"%s"
"<small>%s</small>",
- udisks_object_info_get_description (info),
+ g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL),
model->flags & GDU_DEVICE_TREE_MODEL_FLAGS_ONE_LINE_NAME ? " — " : "\n",
backing_file_unfused);
g_free (backing_file_unfused);
@@ -1137,7 +1138,7 @@ update_block (GduDeviceTreeModel *model,
s = g_strdup_printf ("%s"
"%s"
"<small>%s</small>",
- udisks_object_info_get_description (info),
+ g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL),
model->flags & GDU_DEVICE_TREE_MODEL_FLAGS_ONE_LINE_NAME ? " — " : "\n",
preferred_device);
}
@@ -1155,7 +1156,7 @@ update_block (GduDeviceTreeModel *model,
&iter,
GDU_DEVICE_TREE_MODEL_COLUMN_ICON, udisks_object_info_get_icon (info),
GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
- GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, udisks_object_info_get_sort_key (info),
+ GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, g_locale_to_utf8(udisks_object_info_get_sort_key (info),-1, NULL, NULL, NULL),
GDU_DEVICE_TREE_MODEL_COLUMN_JOBS_RUNNING, jobs_running,
GDU_DEVICE_TREE_MODEL_COLUMN_PULSE, pulse,
GDU_DEVICE_TREE_MODEL_COLUMN_SIZE, size,
@@ -1442,8 +1443,9 @@ sort_func (gconstpointer a,
ib = sort_get_object_info (model, UDISKS_OBJECT (b));
}
- ret = g_strcmp0 (ia != NULL ? udisks_object_info_get_sort_key (ia) : NULL,
- ib != NULL ? udisks_object_info_get_sort_key (ib) : NULL);
+ ret = g_strcmp0 (ia != NULL ? g_locale_to_utf8(udisks_object_info_get_sort_key (ia),-1, NULL, NULL, NULL) : NULL,
+ ib != NULL ? g_locale_to_utf8(udisks_object_info_get_sort_key (ib),-1, NULL, NULL, NULL) : NULL);
+
g_clear_object (&ib);
g_clear_object (&ia);
diff --git a/src/disks/gdurestorediskimagedialog.c b/src/disks/gdurestorediskimagedialog.c
index bccf97e..6d44062 100644
--- a/src/disks/gdurestorediskimagedialog.c
+++ b/src/disks/gdurestorediskimagedialog.c
@@ -12,6 +12,7 @@
#include <glib/gi18n.h>
#include <gio/gunixfdlist.h>
#include <gio/gunixoutputstream.h>
+#include <glib-2.0/gmodule.h>
#include <glib-unix.h>
#include <sys/ioctl.h>
@@ -279,7 +280,9 @@ restore_disk_image_update (DialogData *data)
}
else
{
- s = udisks_client_get_size_for_display (gdu_window_get_client (data->window), uncompressed_size, FALSE, TRUE);
+ gchar *size_for_display = udisks_client_get_size_for_display (gdu_window_get_client (data->window), uncompressed_size, FALSE, TRUE);
+ s = g_locale_to_utf8(size_for_display, -1, NULL, NULL, NULL);
+
/* Translators: Shown for a compressed disk image in the "Size" field.
* The %s is the uncompressed size as a long string, e.g. "4.2 MB (4,300,123 bytes)".
*/
@@ -290,7 +293,9 @@ restore_disk_image_update (DialogData *data)
}
else
{
- image_size_str = udisks_client_get_size_for_display (gdu_window_get_client (data->window), size, FALSE, TRUE);
+ gchar *size_for_display = udisks_client_get_size_for_display (gdu_window_get_client (data->window), size, FALSE, TRUE);
+ image_size_str = g_locale_to_utf8(size_for_display, -1, NULL, NULL, NULL);
+
}
if (data->block_size > 0)
@@ -306,8 +311,9 @@ restore_disk_image_update (DialogData *data)
/* Only complain if slack is bigger than 1MB */
if (data->block_size - size > 1000L*1000L)
{
- s = udisks_client_get_size_for_display (gdu_window_get_client (data->window),
+ gchar * size_for_display = udisks_client_get_size_for_display (gdu_window_get_client (data->window),
data->block_size - size, FALSE, FALSE);
+ s = g_locale_to_utf8(size_for_display ,-1, NULL, NULL, NULL);
restore_warning = g_strdup_printf (_("The disk image is %s smaller than the target device"), s);
g_free (s);
}
@@ -315,8 +321,9 @@ restore_disk_image_update (DialogData *data)
}
else if (size > data->block_size)
{
- s = udisks_client_get_size_for_display (gdu_window_get_client (data->window),
+ gchar * size_for_display = udisks_client_get_size_for_display (gdu_window_get_client (data->window),
size - data->block_size, FALSE, FALSE);
+ s = g_locale_to_utf8(size_for_display ,-1, NULL, NULL, NULL);
restore_error = g_strdup_printf (_("The disk image is %s bigger than the target device"), s);
g_free (s);
}
@@ -539,7 +546,7 @@ restore_disk_image_populate (DialogData *data)
{
UDisksObjectInfo *info;
info = udisks_client_get_object_info (gdu_window_get_client (data->window), data->object);
- gtk_label_set_text (GTK_LABEL (data->destination_label), udisks_object_info_get_one_liner (info));
+ gtk_label_set_text (GTK_LABEL (data->destination_label), g_locale_to_utf8(udisks_object_info_get_one_liner (info),-1, NULL, NULL, NULL));
g_clear_object (&info);
gtk_widget_hide (data->selectable_destination_label);
diff --git a/src/disks/gduvolumegrid.c b/src/disks/gduvolumegrid.c
index 91012b4..3f53a2d 100644
--- a/src/disks/gduvolumegrid.c
+++ b/src/disks/gduvolumegrid.c
@@ -1631,11 +1631,12 @@ create_common_device_info_string (UDisksClient *client,
type = udisks_block_get_id_type (block);
version = udisks_block_get_id_version (block);
- size_str = udisks_client_get_size_for_display (client,
+ gchar * size_for_display = udisks_client_get_size_for_display (client,
element->size,
NO_USE_POW2,
NO_LONG_STRING);
+ size_str = g_locale_to_utf8(size_for_display,-1, NULL, NULL, NULL);
if (is_extended_partition (partition))
{
return size_str;
@@ -1651,7 +1652,7 @@ create_common_device_info_string (UDisksClient *client,
version,
NO_LONG_STRING);
- size_with_type_str = g_strdup_printf ("%s %s", size_str, type_for_display);
+ size_with_type_str = g_strdup_printf ("%s %s", size_str, g_locale_to_utf8(type_for_display, -1, NULL, NULL, NULL));
g_free (type_for_display);
return size_with_type_str;
@@ -1836,7 +1837,7 @@ grid_element_set_details (GduVolumeGrid *grid,
size_str = udisks_client_get_size_for_display (grid->client, element->size, FALSE, FALSE);
element->text = g_strdup_printf ("%s\n%s",
C_("volume-grid", "Free Space"),
- size_str);
+ g_locale_to_utf8(size_str,-1, NULL, NULL, NULL));
g_free (size_str);
}
break;
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 97eb8f0..c6f2b2c 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -18,6 +18,7 @@
#include <glib/gi18n.h>
#include <gio/gunixfdlist.h>
+#include <glib-2.0/gmodule.h>
#include "gduapplication.h"
#include "gduwindow.h"
@@ -1522,7 +1523,8 @@ set_size (GduWindow *window,
SetMarkupFlags flags)
{
gchar *s;
- s = udisks_client_get_size_for_display (window->client, size, FALSE, TRUE);
+ gchar *size_for_display = udisks_client_get_size_for_display (window->client, size, FALSE, TRUE);
+ s = g_locale_to_utf8(size_for_display, -1, NULL, NULL, NULL);
set_markup (window, key_label_id, label_id, s, size);
g_free (s);
}
@@ -1955,8 +1957,9 @@ update_generic_drive_bits (GduWindow *window,
s = NULL;
if (partition_table != NULL)
{
- const gchar *table_type = udisks_partition_table_get_type_ (partition_table);
- s = g_strdup (udisks_client_get_partition_table_type_for_display (window->client, table_type));
+ const gchar *table_type = g_locale_to_utf8(udisks_partition_table_get_type_ (partition_table), -1, NULL, NULL, NULL);
+ const gchar *table_type_for_display = udisks_client_get_partition_table_type_for_display (window->client, table_type);
+ s = g_strdup (g_locale_to_utf8(table_type_for_display, -1, NULL, NULL, NULL));
if (s == NULL)
{
/* Translators: Shown for unknown partitioning type. The first %s is the low-level type. */
@@ -2049,7 +2052,7 @@ update_device_page_for_drive (GduWindow *window,
g_free (s);
}
- hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), udisks_object_info_get_description (info));
+ hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL));
hdy_header_bar_set_subtitle (HDY_HEADER_BAR (window->right_header), str->str);
g_string_free (str, TRUE);
@@ -2184,7 +2187,7 @@ update_device_page_for_drive (GduWindow *window,
set_markup (window,
"devtab-drive-size-label",
"devtab-drive-size-value-label",
- s, SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
+ g_locale_to_utf8(s, -1, NULL, NULL, NULL), SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
g_free (s);
}
else
@@ -2201,7 +2204,7 @@ update_device_page_for_drive (GduWindow *window,
set_markup (window,
"devtab-drive-media-label",
"devtab-drive-media-value-label",
- udisks_object_info_get_media_description (info), SET_MARKUP_FLAGS_NONE);
+ g_locale_to_utf8(udisks_object_info_get_media_description (info),-1, NULL, NULL, NULL), SET_MARKUP_FLAGS_NONE);
}
else
{
@@ -2269,7 +2272,7 @@ update_device_page_for_loop (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), udisks_object_info_get_description (info));
+ hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL));
hdy_header_bar_set_subtitle (HDY_HEADER_BAR (window->right_header), device_desc);
gtk_widget_show (window->devtab_drive_menu_button);
@@ -2325,7 +2328,7 @@ update_device_page_for_fake_block (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), udisks_object_info_get_description (info));
+ hdy_header_bar_set_title (HDY_HEADER_BAR (window->right_header), g_locale_to_utf8(udisks_object_info_get_description (info),-1, NULL, NULL, NULL));
hdy_header_bar_set_subtitle (HDY_HEADER_BAR (window->right_header), device_desc);
gtk_widget_show (window->devtab_drive_menu_button);
@@ -2481,7 +2484,7 @@ update_device_page_for_block (GduWindow *window,
* The second %s is a short string with the space free (e.g. '43 GB').
* The %f is the percentage in use (e.g. 62.2).
*/
- s = g_strdup_printf (_("%s — %s free (%.1f%% full)"), s3, s2,
+ s = g_strdup_printf (_("%s — %s free (%.1f%% full)"), g_locale_to_utf8(s3, -1, NULL, NULL, NULL), g_locale_to_utf8(s2 ,-1, NULL, NULL, NULL),
100.0 * (size - unused_space) / size);
g_free (s3);
g_free (s2);
@@ -2509,7 +2512,7 @@ update_device_page_for_block (GduWindow *window,
if (partition != NULL)
{
- s = udisks_client_get_partition_info (window->client, partition);
+ s = g_locale_to_utf8(udisks_client_get_partition_info (window->client, partition), -1, NULL, NULL, NULL);
if (s == NULL)
s = g_strdup (C_("partition type", "Unknown"));
set_markup (window,
@@ -2631,7 +2634,9 @@ update_device_page_for_block (GduWindow *window,
}
else
{
- s = udisks_client_get_id_for_display (window->client, usage, type, version, TRUE);
+ gchar *id_for_display = udisks_client_get_id_for_display (window->client, usage, type, version, TRUE);
+ s = g_locale_to_utf8(id_for_display ,-1, NULL, NULL, NULL);
+
}
}
else
@@ -3010,13 +3015,13 @@ fs_repair_cb (UDisksFilesystem *filesystem,
if (success)
{
s = g_strdup_printf (_("Filesystem %s on %s has been repaired."),
- name, udisks_object_info_get_name (info));
+ name, g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL));
}
else
{
/* show as result and not error message, because it's not a malfunction of GDU */
s = g_strdup_printf (_("Filesystem %s on %s could not be repaired."),
- name, udisks_object_info_get_name (info));
+ name, g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL));
}
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (message_dialog), "%s", s);
@@ -3233,13 +3238,13 @@ fs_check_cb (UDisksFilesystem *filesystem,
if (consistent)
{
s = g_strdup_printf (_("Filesystem %s on %s is undamaged."),
- name, udisks_object_info_get_name (info));
+ name, g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL));
}
else
{
/* show as result and not error message, because it's not a malfunction of GDU */
s = g_strdup_printf (_("Filesystem %s on %s needs repairing."),
- name, udisks_object_info_get_name (info));
+ name, g_locale_to_utf8(udisks_object_info_get_name (info),-1, NULL, NULL, NULL));
}
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (message_dialog), "%s", s);
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index a5acc92..7335cee 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -11,6 +11,7 @@
#include <glib/gi18n.h>
#include <math.h>
#include <sys/statvfs.h>
+#include <glib-2.0/gmodule.h>
#include "gduutils.h"
@@ -770,7 +771,7 @@ get_widget_for_object (UDisksClient *client,
image = gtk_image_new_from_gicon (udisks_object_info_get_icon (info), GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- label = gtk_label_new (udisks_object_info_get_one_liner (info));
+ label = gtk_label_new (g_locale_to_utf8(udisks_object_info_get_one_liner (info),-1, NULL, NULL, NULL));
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
--
2.27.0

View File

@ -1,40 +0,0 @@
From 20f55290ca0f97925935467e8ddc8f80e19ec5ab Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 29 Nov 2023 17:44:54 +0100
Subject: [PATCH] creatediskimage: Fix crash if image creation has errors
The change to use the dialogue "response" signal made the code release
the last reference to the DialogData before the user could answer, and
when they did, we would crash trying to access it.
Fixes: 6ef5a055debd ("creatediskimage: Use dialog response signal")
Closes: #319
---
src/disks/gducreatediskimagedialog.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index 5f64c81..5d5a4d9 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -466,6 +466,7 @@ on_response (GtkDialog *dialog,
g_clear_error (&error);
}
}
+ dialog_data_unref (data);
}
static gboolean
@@ -514,7 +515,7 @@ on_success (gpointer user_data)
GTK_RESPONSE_NO);
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Close"), GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
- g_signal_connect (dialog, "response", G_CALLBACK (on_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK (on_response), dialog_data_ref (data));
g_free (s);
gtk_window_present (GTK_WINDOW (dialog));
--
2.27.0

Binary file not shown.

Binary file not shown.

View File

@ -1,31 +1,27 @@
%global libhandy_version 1.5.0
Name: gnome-disk-utility Name: gnome-disk-utility
Version: 44.0 Version: 3.38.2
Release: 2 Release: 1
Summary: Libraries and applications for dealing with storage devices Summary: Libraries and applications for dealing with storage devices
License: GPLv2+ License: GPLv2+
URL: https://gitlab.gnome.org/GNOME/gnome-disk-utility URL: https://git.gnome.org/browse/gnome-disk-utility
Source0: https://download.gnome.org/sources/%{name}/44/%{name}-%{version}.tar.xz Source0: https://download.gnome.org/sources/%{name}/3.38/%{name}-%{version}.tar.xz
BuildRequires: meson gcc pkgconfig(gmodule-2.0) pkgconfig(gio-unix-2.0) BuildRequires: meson >= 0.43.0 gcc pkgconfig(gmodule-2.0) pkgconfig(gio-unix-2.0) >= 2.31.0
BuildRequires: pkgconfig(udisks2) pkgconfig(gtk+-3.0) pkgconfig(libsecret-1) BuildRequires: pkgconfig(udisks2) >= 2.1.1 pkgconfig(gtk+-3.0) >= 3.16.0 pkgconfig(libsecret-1) >= 0.7
BuildRequires: pkgconfig(pwquality) pkgconfig(libcanberra-gtk3) pkgconfig(dvdread) BuildRequires: pkgconfig(pwquality) >= 1.0.0 pkgconfig(libcanberra-gtk3) >= 0.1 pkgconfig(dvdread) >= 4.2.0
BuildRequires: pkgconfig(libnotify) pkgconfig(liblzma) pkgconfig(libsystemd) BuildRequires: pkgconfig(libnotify) >= 0.7 pkgconfig(liblzma) >= 5.0.5 pkgconfig(libsystemd) >= 209
BuildRequires: gettext libxslt docbook-style-xsl desktop-file-utils libappstream-glib BuildRequires: gettext libxslt docbook-style-xsl desktop-file-utils libappstream-glib
BuildRequires: pkgconfig(libhandy-1) >= %{libhandy_version}
Requires: udisks2 Requires: udisks2
Requires: libhandy%{?_isa} >= %{libhandy_version}
Patch1: 0001-fix-disks-Fixed-interface-translation-not-displayed.patch
Patch2: 0002-fix-crash-if-image-creation-has-errors.patch
%description %description
This gnome-disk-utility repository provides libraries and applications for This gnome-disk-utility repository provides libraries and applications for
dealing with storage devices. dealing with storage devices.
%package_help %package help
Summary: Help package for gnome-disk-utility
%description help
This package contains some man help files for gnome-disk-utility.
%prep %prep
%autosetup -n %{name}-%{version} -p1 %autosetup -n %{name}-%{version} -p1
@ -43,37 +39,18 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/org.gnome
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%files -f %{name}.lang %files -f %{name}.lang
%doc AUTHORS NEWS README.md %doc AUTHORS COPYING NEWS README.md
%license COPYING
%{_bindir}/* %{_bindir}/*
%{_datadir}/applications/*.desktop %{_datadir}/*
%{_datadir}/dbus-1/services/org.gnome.DiskUtility.service %exclude %{_datadir}/locale
%{_datadir}/glib-2.0/schemas/org.gnome.Disks.gschema.xml
%{_datadir}/icons/hicolor/*/apps/gnome-disks*
%{_datadir}/icons/hicolor/*/apps/org.gnome.DiskUtility*
%{_datadir}/metainfo/org.gnome.DiskUtility.appdata.xml
%{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop %{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop
%{_libexecdir}/gsd-disk-utility-notify %{_libexecdir}/gsd-disk-utility-notify
%exclude %{_datadir}/man*
%files help %files help
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Sat May 11 2024 yanshuai <yanshuai@kylinos.cn> - 44.0-2
- creatediskimage: Fix crash if image creation has errors
* Thu Nov 23 2023 lwg <liweiganga@uniontech.com> - 44.0-1
- update to version 44.0
* Thu Jul 20 2023 longcheng <longcheng@kylinos.com.cn> - 43.0-2
- fix(disks):Fixed interface translation not displayed in GB18030 coding
* Mon Jan 02 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 43.0-1
- update to 43.0
* Mon Mar 28 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 42.0-1
- Update to 42.0
* Tue Jun 22 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.2-1 * Tue Jun 22 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 3.38.2-1
- Upgrade to 3.38.2 - Upgrade to 3.38.2

View File

@ -1,4 +1,4 @@
version_control: gitlab.gnome version_control: gitlab.gnome
src_repo: gnome-disk-utility src_repo: gnome-disk-utility
tag_prefix: ^ tag_prefix: ^
separator: . seperator: .