anjuta r3663 - in trunk: . plugins/profiler



Author: jhs
Date: Fri Feb 15 09:28:10 2008
New Revision: 3663
URL: http://svn.gnome.org/viewvc/anjuta?rev=3663&view=rev

Log:
2008-02-15  James Liggett <jrliggett cox net>

	reviewed by: Johannes Schmid <jhs gnome org>

	* plugins/profiler/gprof-options.c: (setup_widgets),
	(gprof_options_set_target), (gprof_options_has_target),
	(gprof_options_get_string):
	* plugins/profiler/gprof-options.h:
	* plugins/profiler/plugin.c: (ifile_open):
	516128 â crash in Anjuta IDE: selected profiler as the...

Modified:
   trunk/ChangeLog
   trunk/plugins/profiler/gprof-options.c
   trunk/plugins/profiler/gprof-options.h
   trunk/plugins/profiler/plugin.c

Modified: trunk/plugins/profiler/gprof-options.c
==============================================================================
--- trunk/plugins/profiler/gprof-options.c	(original)
+++ trunk/plugins/profiler/gprof-options.c	Fri Feb 15 09:28:10 2008
@@ -208,7 +208,6 @@
 setup_widgets (gchar *key_name, Key *key, GladeXML *gxml)
 {
 	GtkWidget *widget;
-//	GtkWidget *file_chooser_dialog;
 	GtkTextBuffer *buffer;
 	gchar *string;
 	
@@ -293,21 +292,34 @@
 {
 	GHashTable *new_table;
 	
-	/* First, the target must have an entry in the target table. If we don't
-	 * have one, set one up and copy the defaults into it. */
-	
-	if (!g_hash_table_lookup_extended (self->priv->targets, target,
-									   NULL, NULL))
+	if (target)
 	{
-		new_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
-										   g_free);
-		g_hash_table_foreach (self->priv->default_options, (GHFunc) copy_default_key,
-							  new_table);
-		g_hash_table_insert (self->priv->targets, g_strdup (target), new_table);
+		/* First, the target must have an entry in the target table. If we don't
+		 * have one, set one up and copy the defaults into it. */
+		
+		if (!g_hash_table_lookup_extended (self->priv->targets, target,
+										   NULL, NULL))
+		{
+			new_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
+											   g_free);
+			g_hash_table_foreach (self->priv->default_options, 
+								  (GHFunc) copy_default_key, new_table);
+			g_hash_table_insert (self->priv->targets, g_strdup (target), 
+								 new_table);
+		}
+		
+		self->priv->current_target = g_hash_table_lookup (self->priv->targets, 
+														  target);
 	}
-	
-	self->priv->current_target = g_hash_table_lookup (self->priv->targets, 
-													  target);
+	else
+		self->priv->current_target = NULL;
+}
+
+gboolean
+gprof_options_has_target (GProfOptions *self, gchar *target)
+{
+	return g_hash_table_lookup_extended (self->priv->targets, target,
+										 NULL, NULL);
 }
 
 /* Free returned string */
@@ -321,8 +333,8 @@
 	}
 	else
 	{
-		g_warning ("GProfOptions: Trying to get option value with "
-				   "no target.\n");
+		return g_strdup (g_hash_table_lookup (self->priv->default_options,
+											  key));
 	}
 	
 	return NULL;

Modified: trunk/plugins/profiler/gprof-options.h
==============================================================================
--- trunk/plugins/profiler/gprof-options.h	(original)
+++ trunk/plugins/profiler/gprof-options.h	Fri Feb 15 09:28:10 2008
@@ -70,6 +70,7 @@
 void gprof_options_destroy (GProfOptions *self);
 
 void gprof_options_set_target (GProfOptions *self, gchar *target);
+gboolean gprof_options_has_target (GProfOptions *self, gchar *target);
 
 gchar *gprof_options_get_string (GProfOptions *self, const gchar *key);
 gint gprof_options_get_int (GProfOptions *self, const gchar *key);

Modified: trunk/plugins/profiler/plugin.c
==============================================================================
--- trunk/plugins/profiler/plugin.c	(original)
+++ trunk/plugins/profiler/plugin.c	Fri Feb 15 09:28:10 2008
@@ -955,6 +955,16 @@
 	
 	profiler_set_target (profiler, uri);
 	
+	/* Respect user settings for this target if they exist. Otherwise, don't
+	 * create an entry for this target to avoid having the settings file 
+	 * balloon with the settings for a bunch of targets, espcially if this 
+	 * is a one-time operation. If previous settings don't exist, just use
+	 * the defaults. */
+	if (gprof_options_has_target (profiler->options,  (gchar *) uri))
+		gprof_options_set_target (profiler->options, (gchar *) uri);
+	else
+		gprof_options_set_target (profiler->options, NULL);
+	
 	if (profiler_get_data (profiler))
 		gprof_view_manager_refresh_views (profiler->view_manager);
 	



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