Re: Patch for bug-buddy



Wed, Dec 04, 2002 at 11:46:57AM +0100, Fernando Herrera escribió:

>
>
>		Hi!
>	Here is a patch for bug-buddy, that uses the new stuff in .desktop 
>files to make reporting bugs easier. 

	As usually, I forget the patch. Attached now.

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;
Only in bug-buddy/src: bug-buddy.keys
Only in bug-buddy/src: bug-buddy.o
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 10:21:50 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;
@@ -709,6 +776,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 +828,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]