1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From 00eb83fdbc5a6b6d5369b59b00a13293b1981b4f Mon Sep 17 00:00:00 2001
From: Chris Kühl <chrisk@openismus.com>
Date: Wed, 02 Mar 2011 23:00:58 +0000
Subject: Added close button to memory map dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=592758
---
diff --git a/src/memmaps.cpp b/src/memmaps.cpp
index 67255d1..ae8ef1c 100644
--- a/src/memmaps.cpp
+++ b/src/memmaps.cpp
@@ -316,14 +316,15 @@ update_memmaps_dialog (MemMapsData *mmdata)
-static gboolean window_delete_event(GtkWidget *, GdkEvent *, gpointer data)
+static void
+dialog_response (GtkDialog * dialog, gint response_id, gpointer data)
{
MemMapsData * const mmdata = static_cast<MemMapsData*>(data);
g_source_remove (mmdata->timer);
delete mmdata;
- return FALSE;
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -463,26 +464,16 @@ create_single_memmaps_dialog (GtkTreeModel *model, GtkTreePath *path,
mmdata = create_memmapsdata (procdata);
mmdata->info = info;
- memmapsdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_transient_for(GTK_WINDOW(memmapsdialog), GTK_WINDOW(procdata->app));
- gtk_window_set_destroy_with_parent(GTK_WINDOW(memmapsdialog), TRUE);
- // gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
- gtk_window_set_title(GTK_WINDOW(memmapsdialog), _("Memory Maps"));
+ memmapsdialog = gtk_dialog_new_with_buttons (_("Memory Maps"), GTK_WINDOW (procdata->app),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ NULL);
gtk_window_set_resizable(GTK_WINDOW(memmapsdialog), TRUE);
gtk_window_set_default_size(GTK_WINDOW(memmapsdialog), 575, 400);
- gtk_container_set_border_width(GTK_CONTAINER(memmapsdialog), 12);
-
- GtkWidget *mainbox = gtk_vbox_new(FALSE, 12);
- gtk_container_add(GTK_CONTAINER(memmapsdialog), mainbox);
-
- vbox = mainbox;
- gtk_box_set_spacing (GTK_BOX (vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+ gtk_container_set_border_width(GTK_CONTAINER(memmapsdialog), 5);
- dialog_vbox = gtk_vbox_new (FALSE, 6);
+ dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG(memmapsdialog));
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
- gtk_box_pack_start (GTK_BOX (vbox), dialog_vbox, TRUE, TRUE, 0);
-
label = procman_make_label_for_mmaps_or_ofiles (
_("_Memory maps for process \"%s\" (PID %u):"),
@@ -504,11 +495,10 @@ create_single_memmaps_dialog (GtkTreeModel *model, GtkTreePath *path,
gtk_box_pack_start (GTK_BOX (dialog_vbox), scrolled, TRUE, TRUE, 0);
- gtk_widget_show_all (memmapsdialog);
-
- g_signal_connect(G_OBJECT(memmapsdialog), "delete-event",
- G_CALLBACK(window_delete_event), mmdata);
+ g_signal_connect(G_OBJECT(memmapsdialog), "response",
+ G_CALLBACK(dialog_response), mmdata);
+ gtk_widget_show_all (memmapsdialog);
mmdata->timer = g_timeout_add_seconds (5, memmaps_timer, mmdata);
update_memmaps_dialog (mmdata);
--
cgit v0.9
|