[gnome-system-monitor] Added close button to memory map dialog.
- From: Chris Kühl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Added close button to memory map dialog.
- Date: Wed, 2 Mar 2011 23:04:16 +0000 (UTC)
commit 00eb83fdbc5a6b6d5369b59b00a13293b1981b4f
Author: Chris Kühl <chrisk openismus com>
Date: Thu Mar 3 00:00:58 2011 +0100
Added close button to memory map dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=592758
src/memmaps.cpp | 34 ++++++++++++----------------------
1 files changed, 12 insertions(+), 22 deletions(-)
---
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]