[anjuta] Update dialogs and fix inspect/evaluate dialog



commit 64a8bb5b13b94bfb448e1cb0699313d6c608147f
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sat Jul 11 16:47:20 2009 +0200

    Update dialogs and fix inspect/evaluate dialog

 plugins/debug-manager/anjuta-debug-manager.ui |   22 ++--
 plugins/debug-manager/breakpoints.c           |   29 +++---
 plugins/debug-manager/debug_tree.c            |    4 +-
 plugins/debug-manager/plugin.c                |   50 ++++++---
 plugins/debug-manager/start.c                 |  140 +++++++++++--------------
 plugins/debug-manager/watch.c                 |   58 ++++-------
 6 files changed, 145 insertions(+), 158 deletions(-)
---
diff --git a/plugins/debug-manager/anjuta-debug-manager.ui b/plugins/debug-manager/anjuta-debug-manager.ui
index ed75ae7..de45cab 100644
--- a/plugins/debug-manager/anjuta-debug-manager.ui
+++ b/plugins/debug-manager/anjuta-debug-manager.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
   <requires lib="gtk+" version="2.14"/>
-  <!-- interface-naming-policy toplevel-contextual -->
+  <!-- interface-naming-policy project-wide -->
   <object class="GtkDialog" id="attach_process_dialog">
     <property name="title" translatable="yes">Attach to process</property>
     <property name="window_position">center</property>
@@ -1765,9 +1765,11 @@
     <property name="window_position">center-on-parent</property>
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">dialog</property>
+    <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox14">
         <property name="visible">True</property>
+        <property name="spacing">12</property>
         <child>
           <object class="GtkHBox" id="hbox1134">
             <property name="visible">True</property>
@@ -2373,12 +2375,12 @@
     <property name="skip_taskbar_hint">True</property>
     <property name="has_separator">False</property>
     <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox16">
+      <object class="GtkVBox" id="dialog-vbox18">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkHBox" id="hbox9">
             <property name="visible">True</property>
             <property name="border_width">6</property>
             <property name="spacing">12</property>
@@ -2394,12 +2396,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="vbox1">
+              <object class="GtkVBox" id="vbox7">
                 <property name="visible">True</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
-                  <object class="GtkLabel" id="label1">
+                  <object class="GtkLabel" id="label5">
                     <property name="visible">True</property>
                     <property name="ypad">3</property>
                     <property name="label" translatable="yes">&lt;span weight="bold" size="larger"&gt;Are you sure you want to debug a program not using the Debug configuration ?&lt;/span&gt;
@@ -2436,11 +2438,11 @@ When optimizations are enabled, the debugger cannot always identify the source c
           </packing>
         </child>
         <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area16">
+          <object class="GtkHButtonBox" id="dialog-action_area18">
             <property name="visible">True</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button2">
+              <object class="GtkButton" id="button4">
                 <property name="label" translatable="yes">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -2454,7 +2456,7 @@ When optimizations are enabled, the debugger cannot always identify the source c
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button1">
+              <object class="GtkButton" id="button8">
                 <property name="label" translatable="yes">gtk-execute</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -2480,8 +2482,8 @@ When optimizations are enabled, the debugger cannot always identify the source c
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">button2</action-widget>
-      <action-widget response="-5">button1</action-widget>
+      <action-widget response="-6">button4</action-widget>
+      <action-widget response="-5">button8</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/plugins/debug-manager/breakpoints.c b/plugins/debug-manager/breakpoints.c
index ef8d95f..9475568 100644
--- a/plugins/debug-manager/breakpoints.c
+++ b/plugins/debug-manager/breakpoints.c
@@ -1424,7 +1424,7 @@ on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *se
 static void
 breakpoints_dbase_edit_breakpoint (BreakpointsDBase *bd, BreakpointItem *bi)
 {
-	GtkBuilder *bxml = gtk_builder_new ();
+	GtkBuilder *bxml;
 	GtkWidget *dialog;
 	GtkWidget *location_label, *location_entry;
 	GtkWidget *condition_entry, *condition_label;
@@ -1433,22 +1433,22 @@ breakpoints_dbase_edit_breakpoint (BreakpointsDBase *bd, BreakpointItem *bi)
 	gchar *location = NULL;
 	gchar *uri = NULL;
 	gboolean new_break = FALSE;
-	GError* error = NULL;
 
-	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-	{
-		g_warning ("Couldn't load builder file: %s", error->message);
-		g_error_free (error);
-	}
-	dialog = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_properties_dialog"));
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return;
+	anjuta_util_builder_get_objects (bxml,
+	    "breakpoint_properties_dialog", &dialog,
+	    "breakpoint_location_label", &location_label,
+	    "breakpoint_location_entry", &location_entry,
+	    "breakpoint_condition_entry", &condition_entry,
+		"breakpoint_condition_label", &condition_label,
+		"breakpoint_pass_entry", &pass_entry,
+		"breakpoint_pass_label", &pass_label,
+	    NULL);
+	g_object_unref (bxml);
+
 	gtk_window_set_transient_for (GTK_WINDOW (dialog),
 								  GTK_WINDOW (ANJUTA_PLUGIN (bd->plugin)->shell));
-	location_label = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_location_label"));
-	location_entry = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_location_entry"));
-	condition_entry = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_condition_entry"));
-	condition_label = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_condition_label"));
-	pass_entry = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_pass_entry"));
-	pass_label = GTK_WIDGET (gtk_builder_get_object (bxml, "breakpoint_pass_label"));
 
 	if (bd->debugger != NULL)
 	{
@@ -1592,7 +1592,6 @@ breakpoints_dbase_edit_breakpoint (BreakpointsDBase *bd, BreakpointItem *bi)
 	g_free (uri);
 	g_free (location);
 	gtk_widget_destroy (dialog);
-	g_object_unref (bxml);
 }
 
 /* Breakpoint actions list
diff --git a/plugins/debug-manager/debug_tree.c b/plugins/debug-manager/debug_tree.c
index 38d1149..f270def 100644
--- a/plugins/debug-manager/debug_tree.c
+++ b/plugins/debug-manager/debug_tree.c
@@ -922,7 +922,7 @@ debug_tree_add_dummy (DebugTree *tree, GtkTreeIter *parent)
 {
 	GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree->view));
 	GtkTreeIter iter;
-	
+
 	gtk_tree_store_append(GTK_TREE_STORE(model), &iter, parent);
 	gtk_tree_store_set(GTK_TREE_STORE(model), &iter,
 					   VARIABLE_COLUMN, "",
@@ -941,7 +941,7 @@ debug_tree_add_watch (DebugTree *tree, const IAnjutaDebuggerVariableObject* var,
 	GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree->view));
 	GtkTreeIter iter;
 	DmaVariableData *data;
-	
+
 	/* Allocate data */
 	data = dma_variable_data_new(var->name, auto_update);
 	
diff --git a/plugins/debug-manager/plugin.c b/plugins/debug-manager/plugin.c
index 80b5c6e..7126cfd 100644
--- a/plugins/debug-manager/plugin.c
+++ b/plugins/debug-manager/plugin.c
@@ -101,6 +101,8 @@ struct _DebugManagerPlugin
 	DmaThreads *thread;
 	DmaVariableDBase *variable;
 	
+
+	GtkWidget *user_command_dialog;
 	
 	/* Logging view */
 	IAnjutaMessageView* view;
@@ -516,6 +518,9 @@ dma_plugin_debugger_stopped (DebugManagerPlugin *self, GError *err)
 	
 	state = anjuta_shell_get_status(ANJUTA_PLUGIN (self)->shell, NULL);
 	anjuta_status_set_default (state, _("Debugger"), NULL);
+
+	/* Remove user command dialog if existing */
+	if (self->user_command_dialog) gtk_widget_destroy (GTK_WIDGET (self->user_command_dialog));
 	
 	/* Display a warning if debugger stop unexpectedly */
 	if (err != NULL)
@@ -706,27 +711,36 @@ on_debugger_command_entry_activate (GtkEntry *entry, DebugManagerPlugin *plugin)
 static void
 on_debugger_custom_command_activate (GtkAction * action, DebugManagerPlugin *plugin)
 {
-        GtkBuilder *bxml = gtk_builder_new ();
-        GtkWidget *win, *entry;
-		GError* error = NULL;
+	if (plugin->user_command_dialog == NULL)
+	{
+        GtkBuilder *bxml;
+        GtkWidget *entry;
+
+		bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+		if (!bxml) return;
+		anjuta_util_builder_get_objects (bxml,
+		    "debugger_command_dialog", &plugin->user_command_dialog,
+		    "debugger_command_entry", &entry,
+		    NULL);
+        g_object_unref (bxml);
 
-		if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-		{
-			g_warning ("Couldn't load builder file: %s", error->message);
-			g_error_free (error);
-		}
-        win = GTK_WIDGET (gtk_builder_get_object (bxml, "debugger_command_dialog"));
-        entry = GTK_WIDGET (gtk_builder_get_object (bxml, "debugger_command_entry"));
+	    gtk_window_set_transient_for (GTK_WINDOW (plugin->user_command_dialog), GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell));
 
-        gtk_window_set_transient_for (GTK_WINDOW (win),
-                                                                  GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell));
-        g_signal_connect_swapped (win, "response",
+		g_object_add_weak_pointer (G_OBJECT (plugin->user_command_dialog), (gpointer *)&plugin->user_command_dialog);
+	
+        g_signal_connect_swapped (plugin->user_command_dialog, "response",
                                                           G_CALLBACK (gtk_widget_destroy),
-                                                          win);
+                                                         plugin->user_command_dialog);
         g_signal_connect (entry, "activate",
                                           G_CALLBACK (on_debugger_command_entry_activate),
                                           plugin);
-        g_object_unref (bxml);
+
+		gtk_widget_show_all (GTK_WIDGET (plugin->user_command_dialog));
+	}
+	else
+	{
+		gtk_window_present (GTK_WINDOW (plugin->user_command_dialog));
+	}
 }
 
 /* Info callbacks
@@ -1261,6 +1275,8 @@ dma_plugin_instance_init (GObject* obj)
 	plugin->signals = NULL;
 	plugin->sharedlibs = NULL;
 	plugin->view = NULL;
+
+	plugin->user_command_dialog = NULL;
 	
 	/* plugin->uri = NULL; */
 }
@@ -1273,6 +1289,10 @@ dma_plugin_instance_init (GObject* obj)
 static void
 dma_plugin_dispose (GObject* obj)
 {
+	DebugManagerPlugin *plugin = ANJUTA_PLUGIN_DEBUG_MANAGER (obj);
+	
+	if (plugin->user_command_dialog != NULL)	gtk_widget_destroy (GTK_WIDGET (plugin->user_command_dialog));
+
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
 
diff --git a/plugins/debug-manager/start.c b/plugins/debug-manager/start.c
index 411713f..a836ad2 100644
--- a/plugins/debug-manager/start.c
+++ b/plugins/debug-manager/start.c
@@ -740,22 +740,17 @@ attach_process_show (AttachProcess * ap, GtkWindow *parent)
 
 	if (!ap->dialog)
 	{
-		GtkBuilder *bxml = gtk_builder_new ();
-		GError* error = NULL;
-
-		if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-		{
-			g_warning ("Couldn't load builder file: %s", error->message);
-			g_error_free (error);
-		}
-		ap->dialog = GTK_WIDGET (gtk_builder_get_object (bxml, "attach_process_dialog"));
-		ap->treeview = GTK_WIDGET (gtk_builder_get_object (bxml, "attach_process_tv"));
-		checkb_hide_paths = GTK_CHECK_BUTTON (
-								gtk_builder_get_object (bxml, "checkb_hide_paths"));
-		checkb_hide_params = GTK_CHECK_BUTTON (
-								gtk_builder_get_object (bxml, "checkb_hide_params"));
-		checkb_process_tree = GTK_CHECK_BUTTON (
-								gtk_builder_get_object (bxml, "checkb_process_tree"));
+		GtkBuilder *bxml;
+
+		bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+		if (!bxml) return 0;
+		anjuta_util_builder_get_objects (bxml,
+		    "attach_process_dialog", &ap->dialog,
+		    "attach_process_tv", &ap->treeview,
+		    "checkb_hide_paths", &checkb_hide_paths,
+		    "checkb_hide_params", &checkb_hide_params,
+ 			"checkb_process_tree", &checkb_process_tree,
+		    NULL);
 		g_object_unref (bxml);
 	
 		view = GTK_TREE_VIEW (ap->treeview);
@@ -840,12 +835,7 @@ static gboolean
 show_check_debug_dialog (DmaStart *this)
 {
 	GConfClient *client;
-	GtkBuilder *bxml = gtk_builder_new ();
-	GtkWindow *parent;
-	GtkWidget *dialog;
-	GtkToggleButton *do_not_show;
 	gboolean no_check_debug;
-	GError* error = NULL;
 	gint res = GTK_RESPONSE_OK;
 
 	client = gconf_client_get_default ();
@@ -853,19 +843,20 @@ show_check_debug_dialog (DmaStart *this)
 	
 	if (!no_check_debug)
 	{
+		GtkBuilder *bxml;
+		GtkWindow *parent;
+		GtkWidget *dialog;
+		GtkToggleButton *do_not_show;
+		
 		parent = GTK_WINDOW (this->plugin->shell);
 
-		if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-		{
-			g_warning ("Couldn't load builder file: %s", error->message);
-			anjuta_util_dialog_error(parent, _("Missing file %s"), GLADE_FILE);
-			g_error_free (error);
-			return FALSE;
-		}
-
 		/* Fetch out the widget we care about for now */
-		dialog = GTK_WIDGET (gtk_builder_get_object (bxml, CHECK_DEBUG_DIALOG));
-		do_not_show = GTK_TOGGLE_BUTTON (gtk_builder_get_object (bxml, DO_NOT_SHOW_CHECK));
+		bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+		if (!bxml) return FALSE;
+			anjuta_util_builder_get_objects (bxml,
+	    	CHECK_DEBUG_DIALOG, &dialog,
+	    	DO_NOT_SHOW_CHECK, &do_not_show,
+		    NULL);
 		g_object_unref (bxml);
 	
 		res = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -1115,7 +1106,7 @@ static void on_radio_toggled(GtkWidget* toggle_button, GtkWidget* container)
 static gboolean
 show_remote_dialog (DmaStart *this)
 {
-	GtkBuilder *bxml = gtk_builder_new ();
+	GtkBuilder *bxml;
 	GtkWindow *parent;
 	GtkWidget *dialog;
 	GtkEntry *tcpip_address_entry;
@@ -1123,35 +1114,31 @@ show_remote_dialog (DmaStart *this)
 	GtkEntry *serial_port_entry;
 	GtkToggleButton *serial_radio;
 	GtkToggleButton *tcpip_radio;
-	GtkWidget *container;
-	GError* error = NULL;
+	GtkWidget *tcpip_container;
+	GtkWidget *serial_container;
 	gint res;
 
 	parent = GTK_WINDOW (this->plugin->shell);
 
-	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-	{
-		g_warning ("Couldn't load builder file: %s", error->message);
-		anjuta_util_dialog_error(parent, _("Missing file %s"), GLADE_FILE);
-		g_error_free (error);
-		return FALSE;
-	}
-
 	/* Fetch out the widget we care about for now */
-	dialog = GTK_WIDGET (gtk_builder_get_object (bxml, REMOTE_DEBUG_DIALOG));
-	tcpip_address_entry = GTK_ENTRY (gtk_builder_get_object (bxml, TCPIP_ADDRESS_ENTRY));
-	tcpip_port_entry = GTK_ENTRY (gtk_builder_get_object (bxml, TCPIP_PORT_ENTRY));
-	serial_port_entry = GTK_ENTRY (gtk_builder_get_object (bxml, SERIAL_PORT_ENTRY));
-	tcpip_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (bxml, TCPIP_RADIO));
-	serial_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (bxml, SERIAL_RADIO));
-	
-	/* Connect signals */	
-	container = GTK_WIDGET (gtk_builder_get_object (bxml, TCPIP_CONTAINER));
-	g_signal_connect (G_OBJECT (tcpip_radio), "toggled", G_CALLBACK (on_radio_toggled), container);
-	container = GTK_WIDGET (gtk_builder_get_object (bxml, SERIAL_CONTAINER));
-	g_signal_connect (G_OBJECT (serial_radio), "toggled", G_CALLBACK (on_radio_toggled), container);	
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return FALSE;
+	anjuta_util_builder_get_objects (bxml,
+	    REMOTE_DEBUG_DIALOG, &dialog,
+	    TCPIP_ADDRESS_ENTRY, &tcpip_address_entry,
+	    TCPIP_PORT_ENTRY, &tcpip_port_entry,
+	    SERIAL_PORT_ENTRY, &serial_port_entry,
+	    TCPIP_RADIO, &tcpip_radio,
+	    SERIAL_RADIO, &serial_radio,
+	    TCPIP_CONTAINER, &tcpip_container,
+	    SERIAL_CONTAINER, &serial_container,
+	    NULL);
 	g_object_unref (bxml);
 
+	/* Connect signals */	
+	g_signal_connect (G_OBJECT (tcpip_radio), "toggled", G_CALLBACK (on_radio_toggled), tcpip_container);
+	g_signal_connect (G_OBJECT (serial_radio), "toggled", G_CALLBACK (on_radio_toggled), serial_container);	
+
 	/* Populate the remote target */
 	if (this->remote_debugger)
 	{
@@ -1314,39 +1301,36 @@ static void
 add_source_show (DmaStart *this)
 {
 	AddSourceDialog dlg;
-	GtkBuilder *bxml = gtk_builder_new ();
+	GtkBuilder *bxml;
 	GtkWidget *widget;
 	GtkWindow *parent;
 	GtkCellRenderer *renderer;
 	GtkTreeViewColumn *column;
-	GObject *button;
-	GError* error = NULL;
+	GObject *add_button;
+	GObject *remove_button;
+	GObject *up_button;
+	GObject *down_button;
 
 	parent = GTK_WINDOW (this->plugin->shell);
 
-	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-	{
-		g_warning ("Couldn't load builder file: %s", error->message);
-		anjuta_util_dialog_error(parent, _("Missing file %s"), GLADE_FILE);
-		g_error_free (error);
-		return;
-	}
-		
-	widget = GTK_WIDGET (gtk_builder_get_object (bxml, ADD_SOURCE_DIALOG));
-	dlg.tree = GTK_TREE_VIEW (gtk_builder_get_object (bxml, SOURCE_LIST));
-	dlg.entry = GTK_FILE_CHOOSER (gtk_builder_get_object (bxml, SOURCE_ENTRY));
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return;
+	anjuta_util_builder_get_objects (bxml,
+	    ADD_SOURCE_DIALOG, &widget,
+	    SOURCE_LIST, &dlg.tree,
+	    SOURCE_ENTRY, &dlg.entry,
+	    ADD_BUTTON, &add_button,
+	    REMOVE_BUTTON, &remove_button,
+	    UP_BUTTON, &up_button,
+	    DOWN_BUTTON, &down_button,
+	    NULL),
+	g_object_unref (bxml);
 	
 	/* Connect signals */	
-	button = gtk_builder_get_object (bxml, ADD_BUTTON);
-	g_signal_connect (button, "clicked", G_CALLBACK (on_source_add_button), &dlg);
-	button = gtk_builder_get_object (bxml, REMOVE_BUTTON);
-	g_signal_connect (button, "clicked", G_CALLBACK (on_source_remove_button), &dlg);
-	button = gtk_builder_get_object (bxml, UP_BUTTON);
-	g_signal_connect (button, "clicked", G_CALLBACK (on_source_up_button), &dlg);
-	button = gtk_builder_get_object (bxml, DOWN_BUTTON);
-	g_signal_connect (button, "clicked", G_CALLBACK (on_source_down_button), &dlg);
-	
-	g_object_unref (bxml);
+	g_signal_connect (add_button, "clicked", G_CALLBACK (on_source_add_button), &dlg);
+	g_signal_connect (remove_button, "clicked", G_CALLBACK (on_source_remove_button), &dlg);
+	g_signal_connect (up_button, "clicked", G_CALLBACK (on_source_up_button), &dlg);
+	g_signal_connect (down_button, "clicked", G_CALLBACK (on_source_down_button), &dlg);
 
 	renderer = gtk_cell_renderer_text_new ();
 	column = gtk_tree_view_column_new_with_attributes (_("Path"), renderer, "text", 0, NULL);
diff --git a/plugins/debug-manager/watch.c b/plugins/debug-manager/watch.c
index b02dc28..ddf2557 100644
--- a/plugins/debug-manager/watch.c
+++ b/plugins/debug-manager/watch.c
@@ -25,7 +25,6 @@
 #include "debug_tree.h"
 #include "utilities.h"
 
-/*#define DEBUG*/
 #include <glib/gi18n.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/interfaces/ianjuta-editor-selection.h>
@@ -63,47 +62,31 @@ typedef struct _InspectDialog InspectDialog;
 #define ADD_WATCH_DIALOG "add_watch_dialog"
 #define CHANGE_WATCH_DIALOG "change_watch_dialog"
 #define INSPECT_EVALUATE_DIALOG "watch_dialog"
+#define VALUE_TREE "watch_value_treeview"
 #define NAME_ENTRY "add_watch_name_entry"
 #define VALUE_ENTRY "value_entry"
-#define VALUE_TREE "inspect_evaluate_value_treeview"
 #define AUTO_UPDATE_CHECK "auto_update_check"
 
 /* Private functions
  *---------------------------------------------------------------------------*/
 
-#if 0
-static void
-on_entry_updated (const gchar *value, gpointer user_data, GError *err)
-{
-	GtkWidget *entry = GTK_WIDGET (user_data);
-	
-	gtk_entry_set_text (GTK_ENTRY (entry), value);
-	g_object_unref (entry);
-}
-#endif
-
 static void
 debug_tree_inspect_evaluate_dialog (ExprWatch * ew, const gchar* expression)
 {
-	GtkBuilder *bxml = gtk_builder_new ();
+	GtkBuilder *bxml;
 	gint reply;
 	gchar *new_expr;
-	// const gchar *value;
 	InspectDialog dlg;
 	IAnjutaDebuggerVariableObject var = {NULL, NULL, NULL, NULL, FALSE, FALSE, FALSE, -1};
-	GError* error = NULL;
-
-	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-	{
-		g_warning ("Couldn't load builder file: %s", error->message);
-		g_error_free (error);
-	}
 
-	dlg.dialog = GTK_WIDGET (gtk_builder_get_object (bxml, INSPECT_EVALUATE_DIALOG));
-	gtk_window_set_transient_for (GTK_WINDOW (dlg.dialog),
-								  NULL);
-	dlg.treeview = GTK_WIDGET (gtk_builder_get_object (bxml, VALUE_TREE));
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return;
+	anjuta_util_builder_get_objects (bxml,
+	    INSPECT_EVALUATE_DIALOG, &dlg.dialog,
+	    VALUE_TREE, &dlg.treeview,
+	    NULL);
 	g_object_unref (bxml);
+	gtk_window_set_transient_for (GTK_WINDOW (dlg.dialog), NULL);
 
 	/* Create debug tree */
 	dlg.tree = debug_tree_new_with_view (ANJUTA_PLUGIN (ew->plugin), GTK_TREE_VIEW (dlg.treeview));
@@ -118,7 +101,7 @@ debug_tree_inspect_evaluate_dialog (ExprWatch * ew, const gchar* expression)
 	{
 		debug_tree_add_dummy (dlg.tree, NULL);
 	}
-
+	
 	for(;;)
 	{
 		reply = gtk_dialog_run (GTK_DIALOG (dlg.dialog));
@@ -147,26 +130,25 @@ debug_tree_inspect_evaluate_dialog (ExprWatch * ew, const gchar* expression)
 static void
 debug_tree_add_watch_dialog (ExprWatch *ew, const gchar* expression)
 {
-	GtkBuilder *bxml = gtk_builder_new ();
+	GtkBuilder *bxml;
 	GtkWidget *dialog;
 	GtkWidget *name_entry;
 	GtkWidget *auto_update_check;
 	gint reply;
 	IAnjutaDebuggerVariableObject var = {NULL, NULL, NULL, NULL, FALSE, FALSE, FALSE, -1};
-	GError* error = NULL;
 
-	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
-	{
-		g_warning ("Couldn't load builder file: %s", error->message);
-		g_error_free (error);
-	}
 
-	dialog = GTK_WIDGET (gtk_builder_get_object (bxml, ADD_WATCH_DIALOG));
+	bxml = anjuta_util_builder_new (GLADE_FILE, NULL);
+	if (!bxml) return;
+	anjuta_util_builder_get_objects (bxml,
+	    ADD_WATCH_DIALOG, &dialog,
+	    AUTO_UPDATE_CHECK, &auto_update_check,
+	    NAME_ENTRY, &name_entry,
+	    NULL);
+	g_object_unref (bxml);
+	
 	gtk_window_set_transient_for (GTK_WINDOW (dialog),
 								  NULL);
-	auto_update_check = GTK_WIDGET (gtk_builder_get_object (bxml, AUTO_UPDATE_CHECK));
-	name_entry = GTK_WIDGET (gtk_builder_get_object (bxml, NAME_ENTRY));
-	g_object_unref (bxml);
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_update_check), TRUE);
 	gtk_entry_set_text (GTK_ENTRY (name_entry), expression == NULL ? "" : expression);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]