summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-17 15:09:24 +0100
committerinfirit <[email protected]>2014-12-17 17:23:02 +0100
commit586315f06e56d10a8ab7e3fc2a7eada7f67e4d2a (patch)
treef895fe8499ae84de156983ea19eb63400697005d
parent5e80dd2e8e97098b4e0ef97ab1997b114cba0b71 (diff)
downloadmate-system-monitor-586315f06e56d10a8ab7e3fc2a7eada7f67e4d2a.tar.bz2
mate-system-monitor-586315f06e56d10a8ab7e3fc2a7eada7f67e4d2a.tar.xz
Add close button to memory map dialog
Taken from GSM commit: 00eb83fdbc5a6b6d5369b59b00a13293b1981b4f From: Chris Kühl <[email protected]>
-rw-r--r--src/memmaps.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/memmaps.cpp b/src/memmaps.cpp
index b1c0615..352ed45 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));
}
@@ -450,7 +451,7 @@ create_single_memmaps_dialog (GtkTreeModel *model, GtkTreePath *path,
ProcData * const procdata = static_cast<ProcData*>(data);
MemMapsData *mmdata;
GtkWidget *memmapsdialog;
- GtkWidget *dialog_vbox, *vbox;
+ GtkWidget *dialog_vbox;
GtkWidget *label;
GtkWidget *scrolled;
ProcInfo *info;
@@ -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,10 +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), "response",
+ G_CALLBACK(dialog_response), mmdata);
- g_signal_connect(G_OBJECT(memmapsdialog), "delete-event",
- G_CALLBACK(window_delete_event), mmdata);
+ gtk_widget_show_all (memmapsdialog);
mmdata->timer = g_timeout_add_seconds (5, memmaps_timer, mmdata);