Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=gfpm.git;a=commitdiff;h=c4744582f534aaf8217086bd6703b05957013c37

commit c4744582f534aaf8217086bd6703b05957013c37
Author: Priyank <[email protected]>
Date:   Tue Mar 10 13:24:36 2009 +0530

Use a flag to determine whther GFpm is doing a package operation
* This possibly fixes #3657

diff --git a/src/gfpm-interface.c b/src/gfpm-interface.c
index 3d71952..016ab74 100644
--- a/src/gfpm-interface.c
+++ b/src/gfpm-interface.c
@@ -69,6 +69,9 @@ GtkWidget *gfpm_pkgs_tvw = NULL;
/* indicates that the repos were initied atleast once */
gboolean init = FALSE;

+/* indicates gfpm is doing a package install/remove operation */
+gboolean running = FALSE;
+
enum gfpm_cols {
COL_PKG_STATUS,
COL_PKG_ICON,
@@ -519,12 +522,15 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer 
data)
gfpm_icmonitor_start_monitor ();
#endif

-               /* commit transaction */
+               /* set running flag and prepare to commit transaction */
+               running = TRUE;
ret = gfpm_trans_commit (&pdata);

down:
/* release the transaction */
pacman_trans_release ();
+               /* not running */
+               running = FALSE;
/* clear list */
gfpm_package_list_free (GFPM_REMOVE_LIST);
gfpm_apply_dlg_reset ();
@@ -579,12 +585,15 @@ itry:     if (pacman_trans_init(PM_TRANS_TYPE_SYNC, 
flags, gfpm_progress_event, cb_g
gfpm_icmonitor_start_monitor ();
#endif
/* commit transaction */
+               running = TRUE;
ret = gfpm_trans_commit (&pdata);


cleanup:
/* release the transaction */
pacman_trans_release ();
+               running = FALSE;
+
/* clear list */
gfpm_package_list_free (GFPM_INSTALL_LIST);
gfpm_apply_dlg_reset ();
diff --git a/src/gfpm-progress.c b/src/gfpm-progress.c
index c4f19f8..101aad5 100644
--- a/src/gfpm-progress.c
+++ b/src/gfpm-progress.c
@@ -31,6 +31,7 @@
#endif

extern GtkWidget        *gfpm_mw;
+extern gboolean                running;

GtkProgressBar          *progressbar = NULL;
GtkWidget               *progresswindow = NULL;
@@ -99,14 +100,18 @@ gfpm_progress_init (void)
static void
cb_gfpm_close_button_clicked (GtkWidget *button, gpointer data)
{
-       if (!cancelled)
+       if (!cancelled && running)
{
-               gfpm_progress_show (FALSE);
+               if (running)
+               {
+                       pacman_trans_release ();
+                       cancelled = TRUE;
+                       gfpm_progress_show (FALSE);
+               }
}
else
{
-               pacman_trans_release ();
-               cancelled = TRUE;
+               gfpm_progress_show (FALSE);
}

return;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to