Re: Patch for bug-buddy



Wed, Dec 04, 2002 at 11:51:29AM +0100, Fernando Herrera escribió:

>	As usually, I forget the patch. Attached now.

	Well, I want to get a new record in auto-responses :)
This patch had a little problem when going back in an unknow applications.
This second one (attached) fixes it.

	Also, to add some value to this post, a patch for updating
buzilla xml files that bug-buddy includes by default. 
	Now, if bug-buddy is off-line it allways uses the files 
from $PREFIX/share/bug-buddy/... instead of the latest downloaded 
into ~/.gnome2/bug-buddy.d/* Should I fix this(file modification date)?
or wait to use the new download code (2.4 stuff).

	Anyway, the update is trivial and good, so please, apply:
	http://www.eurielec.etsit.upm.es/~fherrera/bug-buddy-updatebugzillas.patch.gz

Salu2


-- 
Fernando Herrera de las Heras
Onírica: análisis, diseño e implantación de soluciones informáticas
http://www.onirica.com
diff -ur bug-buddy.orig/ChangeLog bug-buddy/ChangeLog
--- bug-buddy.orig/ChangeLog	Wed Dec  4 07:26:03 2002
+++ bug-buddy/ChangeLog	Wed Dec  4 10:30:15 2002
@@ -1,3 +1,15 @@
+2002-12-03  Fernando Herrera <fherrera onirica com>
+
+	* src/bugzilla.c (products_list_load): Removed code to autoselect
+	component (it didn't work)
+
+	* src/united-states-of-bug-buddy.c (on_druid_prev_clicked)
+	on_druid_next_clicked: When invoked from crash, try to guess 
+	product and component (from .desktop file) corresponding to the
+	crashed app. When invoked from scratch, after the user has 
+	selected an application, guess the product. This implies skipping
+	two sometimes hard steps.
+
 2002-11-21  Kjartan Maraas  <kmaraas gnome org>
 
 	* src/bugzilla.c (load_bugzilla): Free the path. Fixing a leak
diff -ur bug-buddy.orig/src/bug-buddy.h bug-buddy/src/bug-buddy.h
--- bug-buddy.orig/src/bug-buddy.h	Wed Dec  4 08:56:43 2002
+++ bug-buddy/src/bug-buddy.h	Wed Dec  4 09:18:26 2002
@@ -81,6 +81,9 @@
 typedef struct {
 	GladeXML  *xml;
 	BuddyState state;
+	gboolean	product_skipped;
+	gboolean	component_skipped;
+	gboolean	mostfreq_skipped;
 
 	/* canvas stuff */
 	GnomeCanvasItem *title_box;
diff -ur bug-buddy.orig/src/bugzilla.c bug-buddy/src/bugzilla.c
--- bug-buddy.orig/src/bugzilla.c	Wed Dec  4 07:26:03 2002
+++ bug-buddy/src/bugzilla.c	Wed Dec  4 08:59:50 2002
@@ -1127,26 +1127,8 @@
 		g_hash_table_foreach (druid_data.bugzillas, (GHFunc)add_products, store);
 	} else {
 		g_slist_foreach (druid_data.applications, (GFunc)add_application, store);
-		if (druid_data.current_appname) {
-			app = g_hash_table_lookup (druid_data.program_to_application,
-						   druid_data.current_appname);
-			d(g_print ("looking for: %s -> %p\n", druid_data.current_appname, app));
-			if (app)
-				iter = &app->iter;
-		}
 	}
 	gtk_tree_view_columns_autosize (view);
-
-	d(g_print ("selecting: %p\n", iter));
-
-#if 0
-	/* this doesn't work; gtk treeview is broke */
-	if (iter)
-		gtk_tree_selection_select_iter (selection, iter);
-	else
-		gtk_tree_selection_unselect_all (selection);
-	g_idle_add (unselect, selection);
-#endif
 }
 
 void
diff -ur bug-buddy.orig/src/united-states-of-bug-buddy.c bug-buddy/src/united-states-of-bug-buddy.c
--- bug-buddy.orig/src/united-states-of-bug-buddy.c	Wed Dec  4 07:26:03 2002
+++ bug-buddy/src/united-states-of-bug-buddy.c	Wed Dec  4 16:51:26 2002
@@ -204,10 +204,38 @@
 
 	switch (druid_data.state) {
 	case STATE_DESC:
-		if (GTK_TOGGLE_BUTTON (GET_WIDGET ("no-product-toggle"))->active || !druid_data.product)
+		if (!druid_data.mostfreq_skipped) {
+			newstate = STATE_MOSTFREQ;
+			break;
+		}
+		if (!druid_data.component_skipped && 
+		    !GTK_TOGGLE_BUTTON (GET_WIDGET ("no-product-toggle"))->active) {
+			newstate = STATE_COMPONENT;
+			break;
+		}
+		if (!druid_data.product_skipped) {
 			newstate = STATE_PRODUCT;
-		else if (!druid_data.product->bts->bugs)
+			break;
+		}
+		newstate = STATE_GDB;
+		break;
+	case STATE_MOSTFREQ:
+		if (!druid_data.component_skipped) {
 			newstate = STATE_COMPONENT;
+			break;
+		}
+		if (!druid_data.product_skipped) {
+			newstate = STATE_PRODUCT;
+			break;
+		}
+		newstate = STATE_GDB;
+		break;
+	case STATE_COMPONENT:
+		if (!druid_data.product_skipped) {
+			newstate = STATE_PRODUCT;
+			break;
+		}
+		newstate = STATE_GDB;
 		break;
 	default:
 		break;
@@ -616,8 +644,47 @@
 
 	switch (druid_data.state) {
 	case STATE_GDB:
+	{
+		BugzillaApplication *application;
+		BugzillaProduct *product;
+		BugzillaBTS *bts;
+
 		products_list_load ();
+		if (!druid_data.current_appname)
+			break;
+		
+		application = g_hash_table_lookup(druid_data.program_to_application, druid_data.current_appname);
+		if (!application || !application->bugzilla || !application->product)
+			break;
+
+		bts = g_hash_table_lookup (druid_data.bugzillas, application->bugzilla);
+		if (!bts)
+	       		break;
+		
+		product = g_hash_table_lookup (bts->products, application->product);
+		if (!product)
+			break;
+		
+		druid_data.product = product;
+		bugzilla_product_add_components_to_clist (druid_data.product);
+		buddy_set_text ("email-to-entry", druid_data.product->bts->email);
+		newstate++;
+		druid_data.product_skipped = TRUE;
+		if (application->component) {
+			bugzilla_add_mostfreq (druid_data.product->bts);
+			druid_data.component = g_hash_table_lookup(product->components, application->component);
+			if (!druid_data.component)
+				break;
+				
+			newstate++;
+			druid_data.component_skipped = TRUE;
+			if (!druid_data.product->bts->bugs) {
+				newstate++;
+				druid_data.mostfreq_skipped = TRUE;
+			}
+		}
 		break;
+	}
 	case STATE_PRODUCT:
 	{
 		BugzillaProduct *product = NULL;
@@ -642,6 +709,8 @@
 			druid_data.product = NULL;
 			druid_data.component = NULL;
 			newstate = STATE_DESC;
+			druid_data.component_skipped = TRUE;
+			druid_data.mostfreq_skipped = TRUE;
 			break;
 		}
  
@@ -699,6 +768,8 @@
 				druid_data.product = NULL;
 				druid_data.component = NULL;
 				newstate = STATE_DESC;
+				druid_data.component_skipped = TRUE;
+				druid_data.mostfreq_skipped = TRUE;
 				break;
 			}
 				
@@ -709,6 +780,19 @@
 			bugzilla_product_add_components_to_clist (druid_data.product);
 			buddy_set_text ("email-to-entry", druid_data.product->bts->email);
 		}
+		if (application->component) {
+			bugzilla_add_mostfreq (druid_data.product->bts);
+			druid_data.component = g_hash_table_lookup(product->components, application->component);
+			if (!druid_data.component)
+				break;
+				
+			newstate++;
+			druid_data.component_skipped = TRUE;
+			if (!druid_data.product->bts->bugs) {
+				newstate++;
+				druid_data.mostfreq_skipped = TRUE;
+			}
+		}
 		break;
 	}
 	case STATE_COMPONENT:
@@ -748,6 +832,7 @@
 		}
 		if (!druid_data.product->bts->bugs)
 			newstate++;
+			druid_data.mostfreq_skipped = TRUE;
 		break;
 	}
 	case STATE_MOSTFREQ:


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