[gnome-system-monitor] src: Prepare code-base for port to GTK4
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] src: Prepare code-base for port to GTK4
- Date: Mon, 13 Jun 2022 04:57:30 +0000 (UTC)
commit a4b0977c6c0381f7c3721afcd944b6807bb9a29c
Author: Ondřej Míchal <harrymichal seznam cz>
Date: Mon Apr 11 18:51:11 2022 +0300
src: Prepare code-base for port to GTK4
Some APIs are being removed and already have alternatvies in GTK3. Use
them.
src/memmaps.cpp | 6 ++++--
src/openfiles.cpp | 2 +-
src/procactions.cpp | 38 ++++++++++++++++----------------------
src/procproperties.cpp | 13 +++++++++----
src/setaffinity.cpp | 17 ++++++++++-------
5 files changed, 40 insertions(+), 36 deletions(-)
---
diff --git a/src/memmaps.cpp b/src/memmaps.cpp
index 8827d9f2..fc9264bb 100644
--- a/src/memmaps.cpp
+++ b/src/memmaps.cpp
@@ -446,10 +446,12 @@ create_single_memmaps_dialog (GtkTreeModel *model, GtkTreePath *path,
gtk_window_set_resizable(GTK_WINDOW(memmapsdialog), TRUE);
gtk_window_set_default_size(GTK_WINDOW(memmapsdialog), 620, 400);
- gtk_container_set_border_width(GTK_CONTAINER(memmapsdialog), 5);
dialog_box = GTK_BOX (gtk_dialog_get_content_area (memmapsdialog));
- gtk_container_set_border_width (GTK_CONTAINER (dialog_box), 5);
+ gtk_widget_set_margin_top (GTK_WIDGET (dialog_box), 10);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (dialog_box), 10);
+ gtk_widget_set_margin_start (GTK_WIDGET (dialog_box), 10);
+ gtk_widget_set_margin_end (GTK_WIDGET (dialog_box), 10);
label = procman_make_label_for_mmaps_or_ofiles (
_("_Memory maps for process “%s” (PID %u):"),
diff --git a/src/openfiles.cpp b/src/openfiles.cpp
index f5f479ae..6e7f9bf4 100644
--- a/src/openfiles.cpp
+++ b/src/openfiles.cpp
@@ -338,7 +338,7 @@ create_single_openfiles_dialog (GtkTreeModel *model, GtkTreePath *path,
info->name.c_str(),
info->pid);
- gtk_container_add (GTK_CONTAINER (cmd_grid), GTK_WIDGET (label));
+ gtk_grid_attach (cmd_grid, GTK_WIDGET (label), 0, 0, 1, 1);
scrolled = GTK_SCROLLED_WINDOW (gtk_builder_get_object (builder, "scrolled"));
diff --git a/src/procactions.cpp b/src/procactions.cpp
index 6868d25c..629f383a 100644
--- a/src/procactions.cpp
+++ b/src/procactions.cpp
@@ -70,22 +70,19 @@ renice_single_process (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter
}
}
- /* failed */
- error_msg = g_strdup_printf (
- _("Cannot change the priority of process with PID %d to %d.\n"
- "%s"),
- info->pid, args->arg_value, g_strerror(saved_errno));
-
dialog = GTK_MESSAGE_DIALOG (gtk_message_dialog_new (
NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
+ GtkDialogFlags (GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
- "%s", error_msg));
+ _("Cannot change the priority of process with PID %d to %d.\n"
+ "%s"),
+ info->pid, args->arg_value, g_strerror (saved_errno)));
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_free (error_msg);
+ gtk_widget_show (GTK_WIDGET (dialog));
}
@@ -148,22 +145,19 @@ kill_single_process (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
}
}
- /* failed */
- error_msg = g_strdup_printf (
- _("Cannot kill process with PID %d with signal %d.\n"
- "%s"),
- info->pid, args->arg_value, g_strerror(saved_errno));
-
dialog = GTK_MESSAGE_DIALOG (gtk_message_dialog_new (
NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
+ GtkDialogFlags (GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
- "%s", error_msg));
+ _("Cannot kill process with PID %d with signal %d.\n"
+ "%s"),
+ info->pid, args->arg_value, g_strerror (saved_errno)));
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_free (error_msg);
+ gtk_widget_show (GTK_WIDGET (dialog));
}
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index 74764488..2b855114 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -204,15 +204,20 @@ create_single_procproperties_dialog (GtkTreeModel *model, GtkTreePath *path,
gtk_window_set_resizable (GTK_WINDOW (procpropdialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (procpropdialog), 575, 400);
- gtk_container_set_border_width (GTK_CONTAINER (procpropdialog), 5);
vbox = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (procpropdialog)));
gtk_box_set_spacing (vbox, 2);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+ gtk_widget_set_margin_top (GTK_WIDGET (vbox), 5);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (vbox), 5);
+ gtk_widget_set_margin_start (GTK_WIDGET (vbox), 5);
+ gtk_widget_set_margin_end (GTK_WIDGET (vbox), 5);
+ gtk_box_pack_start (vbox, GTK_WIDGET (dialog_vbox), TRUE, TRUE, 0);
dialog_vbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 6));
- gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
- gtk_box_pack_start (vbox, GTK_WIDGET (dialog_vbox), TRUE, TRUE, 0);
+ gtk_widget_set_margin_top (GTK_WIDGET (dialog_vbox), 5);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (dialog_vbox), 5);
+ gtk_widget_set_margin_start (GTK_WIDGET (dialog_vbox), 5);
+ gtk_widget_set_margin_end (GTK_WIDGET (dialog_vbox), 5);
cmd_hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12));
gtk_box_pack_start (dialog_vbox, GTK_WIDGET (cmd_hbox), FALSE, FALSE, 0);
diff --git a/src/setaffinity.cpp b/src/setaffinity.cpp
index e8c1546d..908e4efb 100644
--- a/src/setaffinity.cpp
+++ b/src/setaffinity.cpp
@@ -327,14 +327,14 @@ create_single_set_affinity_dialog (GtkTreeModel *model,
/* Set default dialog window size */
gtk_widget_set_size_request (affinity_data->dialog, 600, 430);
- /* Set dialog box padding ("border") */
- gtk_container_set_border_width (GTK_CONTAINER (affinity_data->dialog), 5);
-
/* Get dialog content area VBox */
dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (affinity_data->dialog));
- /* Set dialog VBox padding ("border") */
- gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 10);
+ /* Set dialog VBox margin */
+ gtk_widget_set_margin_top (GTK_WIDGET (dialog_vbox), 10);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (dialog_vbox), 10);
+ gtk_widget_set_margin_start (GTK_WIDGET (dialog_vbox), 10);
+ gtk_widget_set_margin_end (GTK_WIDGET (dialog_vbox), 10);
/* Set dialog VBox spacing */
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 10);
@@ -378,8 +378,11 @@ create_single_set_affinity_dialog (GtkTreeModel *model,
/* Create grid for CPU list */
cpulist_grid = GTK_GRID (gtk_grid_new ());
- /* Set CPU list grid padding ("border") */
- gtk_container_set_border_width (GTK_CONTAINER (cpulist_grid), 10);
+ /* Set CPU list grid margin */
+ gtk_widget_set_margin_top (GTK_WIDGET (cpulist_grid), 10);
+ gtk_widget_set_margin_bottom (GTK_WIDGET (cpulist_grid), 10);
+ gtk_widget_set_margin_start (GTK_WIDGET (cpulist_grid), 10);
+ gtk_widget_set_margin_end (GTK_WIDGET (cpulist_grid), 10);
/* Set grid row spacing */
gtk_grid_set_row_spacing (cpulist_grid, 10);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]