[Goodies-commits] r5057 - in xfburn/trunk: . xfburn

David Mohr squisher at xfce.org
Sat Jul 12 08:19:27 CEST 2008


Author: squisher
Date: 2008-07-12 06:19:27 +0000 (Sat, 12 Jul 2008)
New Revision: 5057

Added:
   xfburn/trunk/xfburn/xfburn-main.h
Modified:
   xfburn/trunk/TODO
   xfburn/trunk/xfburn/Makefile.am
   xfburn/trunk/xfburn/xfburn-blank-dialog.c
   xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
   xfburn/trunk/xfburn/xfburn-device-box.c
   xfburn/trunk/xfburn/xfburn-main-window.c
   xfburn/trunk/xfburn/xfburn-main.c
   xfburn/trunk/xfburn/xfburn-progress-dialog.c
Log:
Bugfixes: don't exit program if main window is not shown, don't check for disc validity before drive status has been refreshed

Modified: xfburn/trunk/TODO
===================================================================
--- xfburn/trunk/TODO	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/TODO	2008-07-12 06:19:27 UTC (rev 5057)
@@ -45,3 +45,7 @@
   toggle rockridge and joliet extensions / iso_write_opts profiles
 - check for memory leaks while adding files
 - check if all the enter/leaving of gdk threads slows adding down
+- aborting the adding process can lead to invalid an composition size,
+  or invalid size of a composition item
+- rework refresh_speed_list, to make it more easily understandable when the 
+  disc status should get refreshed

Modified: xfburn/trunk/xfburn/Makefile.am
===================================================================
--- xfburn/trunk/xfburn/Makefile.am	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/Makefile.am	2008-07-12 06:19:27 UTC (rev 5057)
@@ -39,7 +39,8 @@
 	xfburn-directory-browser.h					\
 	xfburn-preferences-dialog.h					\
 	xfburn-stock.h							\
-	xfburn-utils.h	
+	xfburn-utils.h							\
+	xfburn-main.h
 	
 xfburn_SOURCES =							\
 	$(xfburn_headers)						\

Modified: xfburn/trunk/xfburn/xfburn-blank-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-blank-dialog.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-blank-dialog.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -31,6 +31,7 @@
 #include "xfburn-device-box.h"
 #include "xfburn-stock.h"
 #include "xfburn-hal-manager.h"
+#include "xfburn-main.h"
 
 #include "xfburn-blank-dialog.h"
 
@@ -441,6 +442,13 @@
   xfburn_progress_dialog_set_status_with_text (XFBURN_PROGRESS_DIALOG (dialog_progress), final_status, final_message);
   g_free (final_message);
 
+#ifdef HAVE_HAL
+  gdk_threads_enter ();
+  DBG ("blanking done!");
+  xfburn_hal_manager_send_volume_changed ();
+  gdk_threads_leave ();
+#endif 
+
   return TRUE;
 }
 
@@ -512,6 +520,8 @@
     params->blank_mode = get_selected_mode (priv);
     params->eject = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_eject)); 
     g_thread_create ((GThreadFunc) thread_blank, params, FALSE, NULL);
+  } else {
+    xfburn_main_leave_window ();
   }
 }
    
@@ -531,7 +541,10 @@
   GtkWidget *obj;
 
   obj = GTK_WIDGET (g_object_new (XFBURN_TYPE_BLANK_DIALOG, NULL));
+  cb_disc_refreshed (NULL, NULL, XFBURN_BLANK_DIALOG (obj));
 
+  xfburn_main_enter_window ();
+
   return obj;
 }
 

Modified: xfburn/trunk/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-image-dialog.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-burn-image-dialog.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -35,6 +35,7 @@
 #include "xfburn-device-box.h"
 #include "xfburn-stock.h"
 #include "xfburn-settings.h"
+#include "xfburn-main.h"
 
 #include "xfburn-burn-image-dialog.h"
 #include "xfburn-perform-burn.h"
@@ -400,6 +401,8 @@
     gtk_widget_show (dialog_progress);
     
     g_thread_create ((GThreadFunc) thread_burn_iso, priv->params, FALSE, NULL);
+  } else {
+    xfburn_main_leave_window ();
   }
 }
 
@@ -565,6 +568,8 @@
 
   obj = GTK_WIDGET (g_object_new (XFBURN_TYPE_BURN_IMAGE_DIALOG, NULL));
 
+  xfburn_main_enter_window ();
+
   return obj;
 }
 

Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-device-box.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -407,7 +407,6 @@
       break;
     case PROP_BLANK_MODE:
       priv->blank_mode = g_value_get_boolean (value);
-      check_disc_validity (priv);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -491,6 +490,9 @@
   if (!check_disc_validity (priv))
     return;
 
+  if (!priv->show_speed_selection)
+    return;
+
   if (el == NULL) {
     /* a valid disc is in the drive, but no speed list is present */
     GtkTreeIter iter;
@@ -656,7 +658,7 @@
     }
   } else {
     /* for blanking */
-    priv->valid_disc = is_erasable; // (disc_status == BURN_DISC_FULL) || (disc_status == BURN_DISC_APPENDABLE);
+    priv->valid_disc = is_erasable && (disc_status != BURN_DISC_BLANK);
 
     if (!priv->valid_disc) {
       switch (profile_no) {
@@ -768,7 +770,7 @@
   xfburn_busy_cursor (priv->combo_device);
 
   device = xfburn_device_box_get_selected_device (box);
-  if (priv->show_speed_selection && xfburn_device_refresh_supported_speeds (device))
+  if (xfburn_device_refresh_supported_speeds (device))
     fill_combo_speed (box, device);
 
   xfburn_default_cursor (priv->combo_device);
@@ -790,8 +792,7 @@
     //DBG ("Device changed to %s", device->name);
     xfburn_device_refresh_supported_speeds (device);
 
-    if (priv->show_speed_selection)
-      fill_combo_speed (box, device);
+    fill_combo_speed (box, device);
 
     if (priv->show_mode_selection)
       fill_combo_mode (box,device);

Modified: xfburn/trunk/xfburn/xfburn-main-window.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main-window.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-main-window.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -39,6 +39,7 @@
 #include "xfburn-burn-image-dialog.h"
 #include "xfburn-progress-dialog.h"
 #include "xfburn-settings.h"
+#include "xfburn-main.h"
 
 #define XFBURN_MAIN_WINDOW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_MAIN_WINDOW, XfburnMainWindowPrivate))
 
@@ -485,7 +486,7 @@
 action_quit (GtkAction * action, XfburnMainWindow * window)
 {
   // if (xfce_confirm (_("Are sure you want to quit?"), GTK_STOCK_QUIT, _("_Quit")))
-    gtk_main_quit ();
+  gtk_main_quit ();
 }
 
 static void
@@ -664,7 +665,7 @@
 
     g_object_set (priv->welcome_tab, "action_group", priv->action_group, NULL);
   }
-  
+
   return obj;
 }
 

Modified: xfburn/trunk/xfburn/xfburn-main.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-main.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -93,6 +93,37 @@
   return TRUE;
 }
 
+/* globals */
+static int window_counter = 0;
+
+void
+xfburn_main_enter_window ()
+{
+  /* if a main window is present, then it is in control */
+  if (window_counter != -42)
+    window_counter++;
+}
+
+void 
+xfburn_main_leave_window ()
+{
+  /* if a main window is present, then it is in control */
+  if (window_counter == -42)
+    return;
+
+  window_counter--;
+  if (window_counter <= 0)
+    g_idle_add ((GSourceFunc) gtk_main_quit, NULL );
+}
+
+void
+xfburn_main_enter_main_window ()
+{
+  /* mark the window_counter as having a main window */
+  window_counter = -42;
+}
+
+
 /* entry point */
 int
 main (int argc, char **argv)
@@ -160,10 +191,14 @@
 
   /* evaluate parsed command line options */
 
+  if (show_main) {
+    xfburn_main_enter_main_window ();
+  }
+
   if (image_filename != NULL) {
     GtkWidget *dialog = xfburn_burn_image_dialog_new ();
+    other_action = TRUE;
 
-    other_action = TRUE;
     DBG ("image_filename = '%s'\n", image_filename);
 
     if (*image_filename != '\0') {
@@ -193,16 +228,17 @@
 
   /* main window */
   if (!other_action || show_main) {
+    xfburn_main_enter_main_window ();
     mainwin = xfburn_main_window_new ();
 
     gtk_widget_show (mainwin);
   
     if (add_data_composition)
       xfburn_main_window_add_data_composition_with_files (XFBURN_MAIN_WINDOW (mainwin), argc-1, argv+1);
-
-    gtk_main ();
   }
 
+  gtk_main ();
+
   /* shutdown */
 #ifdef HAVE_THUNAR_VFS
   thunar_vfs_shutdown ();

Added: xfburn/trunk/xfburn/xfburn-main.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.h	                        (rev 0)
+++ xfburn/trunk/xfburn/xfburn-main.h	2008-07-12 06:19:27 UTC (rev 5057)
@@ -0,0 +1,33 @@
+/* $Id: xfburn-main.h 4958 2008-06-17 15:11:44Z squisher $ */
+/*
+ * Copyright (c) 2008 David Mohr <david at mcbf.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBURN_MAIN_H__
+#define __XFBURN_MAIN_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+G_BEGIN_DECLS
+
+void xfburn_main_leave_window ();
+void xfburn_main_enter_window ();
+
+G_END_DECLS
+#endif /* __XFBURN_MAIN_H__ */

Modified: xfburn/trunk/xfburn/xfburn-progress-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-progress-dialog.c	2008-07-11 23:20:28 UTC (rev 5056)
+++ xfburn/trunk/xfburn/xfburn-progress-dialog.c	2008-07-12 06:19:27 UTC (rev 5057)
@@ -35,6 +35,7 @@
 
 #include "xfburn-progress-dialog.h"
 #include "xfburn-global.h"
+#include "xfburn-main.h"
 
 #define XFBURN_PROGRESS_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_PROGRESS_DIALOG, XfburnProgressDialogPrivate))
 
@@ -320,11 +321,13 @@
 cb_button_close_clicked (GtkWidget *button, XfburnProgressDialog *dialog)
 {
   gtk_widget_destroy (GTK_WIDGET (dialog));
+  xfburn_main_leave_window ();
 }
 
 static gboolean
 cb_dialog_delete (XfburnProgressDialog * dialog, GdkEvent * event, XfburnProgressDialogPrivate * priv)
 {
+  xfburn_main_leave_window ();
   if (!GTK_WIDGET_SENSITIVE (priv->button_close)) {
     gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
     return TRUE;




More information about the Goodies-commits mailing list