[PATCH] random memprof UI tweaks
- From: Kristian Rietveld <kris gtk org>
- To: memprof-list gnome org
- Subject: [PATCH] random memprof UI tweaks
- Date: 20 Aug 2002 03:14:45 +0200
Hello,
Appended fix makes the file selector in the run dialog work and enables
has_default in some dialogs and some small other things.
I had to convert the run and skip dialogs to GtkDialogs, because the
button handling of the gnome-glade GnomeDialog handling code is a bit
broken (also because the gnome-dialog API misses some things) (still
with me? :). I could cover all details here, but that's not really
interesting.
Other than that, the fix is pretty straightforward.
Kris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/memprof/ChangeLog,v
retrieving revision 1.81
diff -u -p -r1.81 ChangeLog
--- ChangeLog 19 Aug 2002 18:26:46 -0000 1.81
+++ ChangeLog 20 Aug 2002 00:26:34 -0000
@@ -1,3 +1,23 @@
+Tue Aug 19 02:28:34 2002 Kristian Rietveld <kris gtk org>
+
+ * main.c (run_cb), (skip_add_cb), (skip_regexes_add_cb): conversion
+ to GtkDialog.
+
+ * memprof.glade (fileentry1): GnomeFileEntry in the run dialog should
+ be modal, so the file selector there also responds (pointed out
+ by Dennis Smit),
+ (SkipAddDialog, RunDialog, SkipRegexesAddDialog): conversion to
+ GtkDialog and enable has_default again on the appropriate buttons.
+ (Preferences dialog): use stock buttons for add and delete.
+
+ * process.c (process_find_exec): use evil hack for files which are
+ in the home directory (home directory is not in the path, but
+ g_file_exists appears to return true),
+ (process_run): also pass path to program to mp_server_instrument.
+
+ * server.[ch] (mp_server_instrument): use program value processed by
+ process_find_exec and not args[0].
+
Mon Aug 19 14:25:39 2002 Owen Taylor <otaylor redhat com>
* memintercept.c: Fix leftover commenting out of code.
Index: main.c
===================================================================
RCS file: /cvs/gnome/memprof/main.c,v
retrieving revision 1.23
diff -u -p -r1.23 main.c
--- main.c 17 Aug 2002 18:59:57 -0000 1.23
+++ main.c 20 Aug 2002 00:26:34 -0000
@@ -832,9 +832,9 @@ run_cb (GtkWidget *widget)
g_object_unref (G_OBJECT (xml));
while (1) {
- gnome_dialog_set_parent (GNOME_DIALOG (run_dialog),
- GTK_WINDOW (pwin->main_window));
- if (gnome_dialog_run (GNOME_DIALOG (run_dialog)) == 1) {
+ gtk_window_set_transient_for (GTK_WINDOW (run_dialog),
+ GTK_WINDOW (pwin->main_window));
+ if (gtk_dialog_run (GTK_DIALOG (run_dialog)) == 1) {
gchar **args;
char *text;
gboolean result;
@@ -1018,9 +1018,10 @@ skip_add_cb (GtkWidget *widget, GladeXML
g_object_unref (G_OBJECT (xml));
while (1) {
- gnome_dialog_set_parent (GNOME_DIALOG (dialog),
- GTK_WINDOW (property_box));
- if (gnome_dialog_run (GNOME_DIALOG (dialog)) == 1) {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (property_box));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == 1) {
text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
if (strchr (text, ' ')) {
@@ -1116,9 +1117,10 @@ skip_regexes_add_cb (GtkWidget *widget,
g_object_unref (G_OBJECT (xml));
while (1) {
- gnome_dialog_set_parent (GNOME_DIALOG (dialog),
- GTK_WINDOW (property_box));
- if (gnome_dialog_run (GNOME_DIALOG (dialog)) == 1) {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (property_box));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == 1) {
text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
if (strchr (text, ' ')) {
Index: memprof.glade
===================================================================
RCS file: /cvs/gnome/memprof/memprof.glade,v
retrieving revision 1.14
diff -u -p -r1.14 memprof.glade
--- memprof.glade 15 Jul 2002 23:39:00 -0000 1.14
+++ memprof.glade 20 Aug 2002 00:26:35 -0000
@@ -1155,15 +1155,13 @@
</property>
<property name="comments" translatable="yes">Memory Profiling Tool</property>
</widget>
- <widget class="GnomeDialog" id="SkipAddDialog">
+ <widget class="GtkDialog" id="SkipAddDialog">
<property name="visible">no</property>
<property name="title" translatable="yes">Adding Skip Function</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
- <property name="auto_close">no</property>
- <property name="hide_on_close">yes</property>
<property name="window-position">GTK_WIN_POS_NONE</property>
<child internal-child="vbox">
@@ -1186,18 +1184,20 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
+ <property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="SkipAddDialog-add">
<property name="can_default">yes</property>
-<!-- <property name="has_default">yes</property> -->
+ <property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label">gtk-add</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
+ <property name="response_id">1</property>
</widget>
</child>
</widget>
@@ -1290,15 +1290,13 @@
</packing>
</child>
</widget>
- <widget class="GnomeDialog" id="RunDialog">
+ <widget class="GtkDialog" id="RunDialog">
<property name="visible">no</property>
<property name="title" translatable="yes">Run Executable</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
- <property name="auto_close">yes</property>
- <property name="hide_on_close">yes</property>
<property name="window-position">GTK_WIN_POS_NONE</property>
<child internal-child="vbox">
@@ -1321,18 +1319,20 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
+ <property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="RunDialog-run">
<property name="can_default">yes</property>
-<!-- <property name="has_default">yes</property> -->
+ <property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="label">gtk-execute</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
<property name="visible">yes</property>
+ <property name="response_id">1</property>
</widget>
</child>
</widget>
@@ -1391,7 +1391,7 @@
<child>
<widget class="GnomeFileEntry" id="fileentry1">
<property name="history_id">RunDialog</property>
- <property name="modal">no</property>
+ <property name="modal">yes</property>
<property name="directory_entry">no</property>
<property name="visible">yes</property>
@@ -1503,15 +1503,13 @@
</widget>
</child>
</widget>
- <widget class="GnomeDialog" id="SkipRegexesAddDialog">
+ <widget class="GtkDialog" id="SkipRegexesAddDialog">
<property name="visible">no</property>
<property name="title" translatable="yes">Adding Skip Regular Expression</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
- <property name="auto_close">no</property>
- <property name="hide_on_close">yes</property>
<property name="window-position">GTK_WIN_POS_NONE</property>
<child internal-child="vbox">
@@ -1534,18 +1532,20 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
+ <property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="SkipRegexesAddDialog-add">
<property name="can_default">yes</property>
-<!-- <property name="has_default">yes</property> -->
+ <property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label">gtk-add</property>
<property name="use_stock">yes</property>
<property name="use_underline">yes</property>
+ <property name="response_id">1</property>
</widget>
</child>
</widget>
@@ -1759,7 +1759,9 @@
<child>
<widget class="GtkButton" id="skip-add-button">
<property name="can_focus">yes</property>
- <property name="label" translatable="yes">Add...</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="visible">yes</property>
</widget>
@@ -1773,7 +1775,9 @@
<child>
<widget class="GtkButton" id="skip-delete-button">
<property name="can_focus">yes</property>
- <property name="label" translatable="yes">Delete</property>
+ <property name="label">gtk-delete</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="visible">yes</property>
</widget>
@@ -1913,7 +1917,9 @@
<child>
<widget class="GtkButton" id="skip-regexes-add-button">
<property name="can_focus">yes</property>
- <property name="label" translatable="yes">Add...</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="visible">yes</property>
</widget>
@@ -1927,7 +1933,9 @@
<child>
<widget class="GtkButton" id="skip-regexes-delete-button">
<property name="can_focus">yes</property>
- <property name="label" translatable="yes">Delete</property>
+ <property name="label">gtk-delete</property>
+ <property name="use_stock">yes</property>
+ <property name="use_underline">yes</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="visible">yes</property>
</widget>
Index: process.c
===================================================================
RCS file: /cvs/gnome/memprof/process.c,v
retrieving revision 1.23
diff -u -p -r1.23 process.c
--- process.c 17 Aug 2002 18:59:57 -0000 1.23
+++ process.c 20 Aug 2002 00:26:35 -0000
@@ -654,6 +654,21 @@ process_find_exec (char **args)
int i;
if (g_file_exists(args[0])) {
+ /* evil */
+ int j;
+ int len = strlen (args[0]);
+
+ for (j = 0; j < len; j++)
+ if (args[0][j] == '/')
+ break;
+
+ puts (args[0]);
+ if (j == len)
+ /* no slash found, assume path in current directory,
+ * append "./", so loading the exec won't fail.
+ */
+ return g_strdup_printf ("./%s", args[0]);
+
return g_strdup (args[0]);
} else {
char **paths;
@@ -811,7 +826,7 @@ process_run (MPProcess *process, const c
process->program_name = g_strdup (path);
read_inode (path);
- process->pid = mp_server_instrument (process->server, args);
+ process->pid = mp_server_instrument (process->server, path, args);
mp_server_add_process (process->server, process);
process_set_status (process, MP_PROCESS_STARTING);
Index: server.c
===================================================================
RCS file: /cvs/gnome/memprof/server.c,v
retrieving revision 1.10
diff -u -p -r1.10 server.c
--- server.c 11 Aug 2002 19:15:02 -0000 1.10
+++ server.c 20 Aug 2002 00:26:36 -0000
@@ -188,7 +188,7 @@ mp_server_new (void)
}
int
-mp_server_instrument (MPServer *server, char **args)
+mp_server_instrument (MPServer *server, const char *program, char **args)
{
int pid;
@@ -206,7 +206,7 @@ mp_server_instrument (MPServer *server,
envstr = g_strdup_printf ("%s=%s", "LD_PRELOAD", server->lib_location);
putenv (envstr);
- execvp (args[0], args);
+ execvp (program, args);
g_warning ("Cannot run program: %s", g_strerror (errno));
_exit(1);
Index: server.h
===================================================================
RCS file: /cvs/gnome/memprof/server.h,v
retrieving revision 1.3
diff -u -p -r1.3 server.h
--- server.h 15 Jul 2002 23:39:00 -0000 1.3
+++ server.h 20 Aug 2002 00:26:36 -0000
@@ -34,8 +34,9 @@ typedef struct _MPServerClass MPServerCl
GType mp_server_get_type (void);
MPServer *mp_server_new (void);
-int mp_server_instrument (MPServer *server,
- char **args);
+int mp_server_instrument (MPServer *server,
+ const char *program,
+ char **args);
MPProcess *mp_server_find_process (MPServer *server,
pid_t pid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]