summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2006-06-18 13:24:26 +0000
committerAkira TAGOH <akira@tagoh.org>2006-06-18 13:24:26 +0000
commit040783d736e289294b0affc1f0bce722037e64b4 (patch)
tree61c269545df7d434bca03f7bfad1ab1abd6bf07b /src
parent1976e688a752db17a6256b254f4e3b133ea11c2e (diff)
* src/hgspy.c (_hgspy_entry_activate_cb): don't send anything
if VM isn't running. (main): added visualizer widget into VPaned. * src/visualizer.c (hg_memory_visualizer_real_size_request): new function.
Diffstat (limited to 'src')
-rw-r--r--src/hgspy.c31
-rw-r--r--src/visualizer.c7
2 files changed, 24 insertions, 14 deletions
diff --git a/src/hgspy.c b/src/hgspy.c
index fc1d97f..f9faea7 100644
--- a/src/hgspy.c
+++ b/src/hgspy.c
@@ -572,14 +572,16 @@ _hgspy_entry_activate_cb(GtkWidget *widget,
text = gtk_entry_get_text(entry);
if (text == NULL || text[0] == 0)
return;
- echoback = g_strdup_printf("%s%s\n",
- gtk_label_get_text(GTK_LABEL (spy->prompt)),
- text);
- _hgspy_insert_text_into_textview(spy, echoback, strlen(echoback));
- g_free(echoback);
- spy->statementedit_buffer = g_strdup(text);
+ if (spy->vm) {
+ echoback = g_strdup_printf("%s%s\n",
+ gtk_label_get_text(GTK_LABEL (spy->prompt)),
+ text);
+ _hgspy_insert_text_into_textview(spy, echoback, strlen(echoback));
+ g_free(echoback);
+ spy->statementedit_buffer = g_strdup(text);
+ gtk_widget_set_sensitive(spy->entry, FALSE);
+ }
gtk_entry_set_text(entry, "");
- gtk_widget_set_sensitive(spy->entry, FALSE);
}
static void
@@ -638,6 +640,7 @@ main(int argc,
GModule *module;
HgSpy *spy;
GtkWidget *menubar, *vbox, *none, *table, *label, *hbox, *vbox2, *scrolled, *hbox2;
+ GtkWidget *vpaned, *vbox3;
GtkActionGroup *actions;
GtkActionEntry action_entries[] = {
/* toplevel menu */
@@ -776,10 +779,12 @@ main(int argc,
spy->ui = gtk_ui_manager_new();
vbox = gtk_vbox_new(FALSE, 0);
vbox2 = gtk_vbox_new(FALSE, 0);
+ vbox3 = gtk_vbox_new(FALSE, 0);
hbox = gtk_hbox_new(FALSE, 0);
hbox2 = gtk_hbox_new(FALSE, 0);
table = gtk_table_new(3, 2, FALSE);
scrolled = gtk_scrolled_window_new(NULL, NULL);
+ vpaned = gtk_vpaned_new();
spy->total_vm_size = gtk_entry_new();
spy->used_vm_size = gtk_entry_new();
spy->free_vm_size = gtk_entry_new();
@@ -865,13 +870,15 @@ main(int argc,
gtk_container_add(GTK_CONTAINER (scrolled), spy->textview);
gtk_box_pack_start(GTK_BOX (vbox2), scrolled, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (hbox2), spy->prompt, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX (hbox2), spy->entry, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX (hbox2), spy->entry, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (hbox), table, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX (vbox), spy->status, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER (spy->window), vbox);
+ gtk_paned_pack1(GTK_PANED (vpaned), vbox, TRUE, FALSE);
+ gtk_paned_pack2(GTK_PANED (vpaned), hbox, TRUE, FALSE);
+ gtk_box_pack_start(GTK_BOX (vbox3), vpaned, TRUE, TRUE, 0);
+ gtk_box_pack_end(GTK_BOX (vbox3), spy->status, FALSE, FALSE, 0);
+ gtk_container_add(GTK_CONTAINER (spy->window), vbox3);
/* setup signals */
g_signal_connect(spy->visualizer, "pool-updated",
diff --git a/src/visualizer.c b/src/visualizer.c
index 57804c7..ec276d1 100644
--- a/src/visualizer.c
+++ b/src/visualizer.c
@@ -155,13 +155,15 @@ hg_memory_visualizer_real_destroy(GtkObject *object)
}
/* GtkWidget */
-#if 0
static void
hg_memory_visualizer_real_size_request(GtkWidget *widget,
GtkRequisition *requisition)
{
+ GtkWidget *parent = gtk_widget_get_parent(widget);
+
+ requisition->width = widget->requisition.width = parent->requisition.width;
+ requisition->height = widget->requisition.height = parent->requisition.height;
}
-#endif
static void
hg_memory_visualizer_real_size_allocate(GtkWidget *widget,
@@ -323,6 +325,7 @@ hg_memory_visualizer_class_init(HgMemoryVisualizerClass *klass)
widget_class->unrealize = hg_memory_visualizer_real_unrealize;
widget_class->map = hg_memory_visualizer_real_map;
widget_class->unmap = hg_memory_visualizer_real_unmap;
+ widget_class->size_request = hg_memory_visualizer_real_size_request;
widget_class->size_allocate = hg_memory_visualizer_real_size_allocate;
/* initialize HgMemoryVisualizer */