[Planner Dev] Bug 327909 -- "File -> Close" not behaving correctly



Hello,
  I've been using planner for quite sometime (and Linux for several
years) and I would like to start giving back to the community.  I don't
know much (yet) about C and GTK programming, but I am learning.  I found
a relatively easy bug to fix and this is my attempt at trying to fix it.
I'd appreciate some feedback, but please go easy on me. :-)

  Should this have been posted on the bugzilla instead?

Thanks,
  Russ McDermott
* looking for planner bazaar ubuntu com/planner--MAIN--0--patch-824 to compare with
* comparing to planner bazaar ubuntu com/planner--MAIN--0--patch-824: ... done.

* modified files

--- orig/src/planner-application.c
+++ mod/src/planner-application.c
@@ -290,3 +290,13 @@
 	return app->priv->recent_model;
 }
 
+int 
+get_num_of_windows (PlannerApplication *application)
+{
+	PlannerApplicationPriv *priv;
+	int				list_length;
+	
+	priv = application->priv;
+	list_length = g_list_length (priv->windows);
+	return list_length;
+}


--- orig/src/planner-application.h
+++ mod/src/planner-application.h
@@ -55,5 +55,6 @@
 GtkWidget       *     planner_application_new_window       (PlannerApplication *app);
 void                  planner_application_exit             (PlannerApplication *app);
 EggRecentModel  *     planner_application_get_recent_model (PlannerApplication *app);
+int					  get_num_of_windows					(PlannerApplication *app);
 
 #endif /* __PLANNER_APPLICATION_H__ */


--- orig/src/planner-window.c
+++ mod/src/planner-window.c
@@ -1092,6 +1092,20 @@
 window_close_cb (GtkAction *action,
 		 gpointer   data)
 {
+	PlannerWindow     *window;
+	PlannerWindowPriv *priv;
+	GtkWidget         *new_window;
+	int				   num_of_windows;
+	
+	window = PLANNER_WINDOW (data);
+	priv   = window->priv;
+	num_of_windows = get_num_of_windows(priv->application);
+	
+	if (num_of_windows == 1){
+		new_window = planner_application_new_window (priv->application);
+		gtk_widget_show_all (new_window);
+	}
+	
 	planner_window_close (PLANNER_WINDOW (data));
 }
 





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