Commit 7283a815 authored by Philippe Rouquier's avatar Philippe Rouquier Committed by Philippe Rouquier

Lots of bug fixes and patches delayed due to the closing of SVN

2008-05-17  Philippe Rouquier  <algernon@localhost.localdomain>

	Lots of bug fixes and patches delayed due to the closing of SVN

	Added multisession/grow images capabilites to libisofs/libburn

	Many improvements to libburn backend

	Fix a problem when retrieving size for multisession images with mkisofs/genisoimage
	
	Added message infrastructure to project and removed libnotify deps
	Now multisession message is displayed like project loading and too little free space

	Make DBus dependency compulsory
	
	No medium reload before checksum now
	One known bug is with tracks with less than 300 sectors.
	That needs further work (reading disc tree structure through read_cd)

	Remove close if successful burning option from burn dialog

	Fix session label potential crash

	Fix libdvdcss plugin appearing in plugin dialog

	* configure.in:
	* src/Makefile.am:
	* src/brasero-async-task-manager.c
	(brasero_async_task_manager_foreach_active_remove):
	* src/brasero-audio-disc.c (brasero_audio_disc_add_ui):
	* src/brasero-burn-dialog.c (brasero_burn_dialog_init),
	(brasero_burn_dialog_finalize), (brasero_burn_dialog_success_run),
	(brasero_burn_dialog_end_session),
	(brasero_burn_dialog_tray_show_dialog_cb):
	* src/brasero-data-disc.c (brasero_data_disc_import_session),
	(brasero_data_disc_import_session_cb),
	(brasero_data_disc_project_loaded_cb),
	(brasero_disc_disc_session_import_response_cb),
	(brasero_data_disc_session_available_cb),
	(brasero_data_disc_clear), (brasero_data_disc_reset),
	(brasero_data_disc_message_response_cb),
	(brasero_data_disc_load_track), (brasero_data_disc_add_ui),
	(brasero_data_disc_init), (brasero_data_disc_finalize):
	* src/brasero-disc-message.c (brasero_disc_message_timeout),
	(brasero_disc_message_set_timeout),
	(brasero_disc_message_button_clicked_cb),
	(brasero_disc_message_add_button),
	(brasero_disc_message_add_close_button), (style_set),
	(brasero_disc_message_init), (brasero_disc_message_finalize),
	(brasero_disc_message_realize):
	* src/brasero-disc-message.h:
	* src/brasero-disc-option-dialog.c
	(brasero_disc_option_dialog_title_widget):
	* src/brasero-disc.c (brasero_disc_add_ui):
	* src/brasero-disc.h:
	* src/brasero-notify.c (brasero_notify_remove_all_messages),
	(brasero_notify_get_message_by_context_id),
	(brasero_notify_message_remove), (brasero_notify_message_add),
	(brasero_notify_button_add), (brasero_notify_init),
	(brasero_notify_finalize), (brasero_notify_class_init),
	(brasero_notify_new):
	* src/brasero-notify.h:
	* src/brasero-project.c (brasero_project_init),
	(brasero_project_error_size_dialog), (brasero_project_check_size),
	(brasero_project_switch):
	* src/brasero-tray.c:
	* src/burn-caps.c (brasero_caps_disc_new_attribute),
	(brasero_caps_disc_new_subtype):
	* src/burn-dbus.c (brasero_inhibit_suspend):
	* src/burn-dbus.h:
	* src/burn-medium.c (brasero_medium_get_next_writable_address),
	(brasero_medium_track_get_info), (brasero_medium_reload_info):
	* src/burn-medium.h:
	* src/burn.c (brasero_burn_record_session), (brasero_burn_check),
	(brasero_burn_record), (brasero_burn_blank):
	* src/main.c (main):
	* src/plugins/cdrkit/burn-genisoimage.c
	(brasero_genisoimage_set_argv_image),
	(brasero_genisoimage_export_caps):
	* src/plugins/cdrtools/burn-mkisofs.c
	(brasero_mkisofs_set_argv_image), (brasero_mkisofs_export_caps):
	* src/plugins/checksum/burn-checksum-image.c
	(brasero_checksum_image_checksum_fd_input):
	* src/plugins/libburnia/Makefile.am:
	* src/plugins/libburnia/burn-libburn-common.c
	(brasero_libburn_common_ctx_free),
	(brasero_libburn_common_ctx_new),
	(brasero_libburn_common_status_changed),
	(brasero_libburn_common_status):
	* src/plugins/libburnia/burn-libburn-common.h:
	* src/plugins/libburnia/burn-libburn.c
	(brasero_libburn_src_free_data), (brasero_libburn_src_get_size),
	(brasero_libburn_src_set_size), (brasero_libburn_src_read_xt),
	(brasero_libburn_create_fd_source), (brasero_libburn_add_fd_track),
	(brasero_libburn_add_file_track),
	(brasero_libburn_setup_session_fd),
	(brasero_libburn_setup_session_file),
	(brasero_libburn_start_record), (brasero_libburn_start_erase),
	(brasero_libburn_stop), (brasero_libburn_clock_tick),
	(brasero_libburn_finalize), (brasero_libburn_export_caps):
	* src/plugins/libburnia/burn-libisofs.c
	(brasero_libisofs_create_image), (brasero_libisofs_import_read),
	(brasero_libisofs_import_open), (brasero_libisofs_import_close),
	(brasero_libisofs_import_free),
	(brasero_libisofs_import_last_session),
	(brasero_libisofs_create_volume_thread),
	(brasero_libisofs_create_volume), (brasero_libisofs_stop_real),
	(brasero_libisofs_clean_output), (brasero_libisofs_export_caps):

svn path=/trunk/; revision=816
parent 9793d538
2008-05-17 Philippe Rouquier <algernon@localhost.localdomain>
Lots of bug fixes and patches delayed due to the closing of SVN
Added multisession/grow images capabilites to libisofs/libburn
Many improvements to libburn backend
Fix a problem when retrieving size for multisession images with mkisofs/genisoimage
Added message infrastructure to project and removed libnotify deps
Now multisession message is displayed like project loading and too little free space
Make DBus dependency compulsory
No medium reload before checksum now
One known bug is with tracks with less than 300 sectors.
That needs further work (reading disc tree structure through read_cd)
Remove close if successful burning option from burn dialog
Fix session label potential crash
Fix libdvdcss plugin appearing in plugin dialog
* configure.in:
* src/Makefile.am:
* src/brasero-async-task-manager.c
(brasero_async_task_manager_foreach_active_remove):
* src/brasero-audio-disc.c (brasero_audio_disc_add_ui):
* src/brasero-burn-dialog.c (brasero_burn_dialog_init),
(brasero_burn_dialog_finalize), (brasero_burn_dialog_success_run),
(brasero_burn_dialog_end_session),
(brasero_burn_dialog_tray_show_dialog_cb):
* src/brasero-data-disc.c (brasero_data_disc_import_session),
(brasero_data_disc_import_session_cb),
(brasero_data_disc_project_loaded_cb),
(brasero_disc_disc_session_import_response_cb),
(brasero_data_disc_session_available_cb),
(brasero_data_disc_clear), (brasero_data_disc_reset),
(brasero_data_disc_message_response_cb),
(brasero_data_disc_load_track), (brasero_data_disc_add_ui),
(brasero_data_disc_init), (brasero_data_disc_finalize):
* src/brasero-disc-message.c (brasero_disc_message_timeout),
(brasero_disc_message_set_timeout),
(brasero_disc_message_button_clicked_cb),
(brasero_disc_message_add_button),
(brasero_disc_message_add_close_button), (style_set),
(brasero_disc_message_init), (brasero_disc_message_finalize),
(brasero_disc_message_realize):
* src/brasero-disc-message.h:
* src/brasero-disc-option-dialog.c
(brasero_disc_option_dialog_title_widget):
* src/brasero-disc.c (brasero_disc_add_ui):
* src/brasero-disc.h:
* src/brasero-notify.c (brasero_notify_remove_all_messages),
(brasero_notify_get_message_by_context_id),
(brasero_notify_message_remove), (brasero_notify_message_add),
(brasero_notify_button_add), (brasero_notify_init),
(brasero_notify_finalize), (brasero_notify_class_init),
(brasero_notify_new):
* src/brasero-notify.h:
* src/brasero-project.c (brasero_project_init),
(brasero_project_error_size_dialog), (brasero_project_check_size),
(brasero_project_switch):
* src/brasero-tray.c:
* src/burn-caps.c (brasero_caps_disc_new_attribute),
(brasero_caps_disc_new_subtype):
* src/burn-dbus.c (brasero_inhibit_suspend):
* src/burn-dbus.h:
* src/burn-medium.c (brasero_medium_get_next_writable_address),
(brasero_medium_track_get_info), (brasero_medium_reload_info):
* src/burn-medium.h:
* src/burn.c (brasero_burn_record_session), (brasero_burn_check),
(brasero_burn_record), (brasero_burn_blank):
* src/main.c (main):
* src/plugins/cdrkit/burn-genisoimage.c
(brasero_genisoimage_set_argv_image),
(brasero_genisoimage_export_caps):
* src/plugins/cdrtools/burn-mkisofs.c
(brasero_mkisofs_set_argv_image), (brasero_mkisofs_export_caps):
* src/plugins/checksum/burn-checksum-image.c
(brasero_checksum_image_checksum_fd_input):
* src/plugins/libburnia/Makefile.am:
* src/plugins/libburnia/burn-libburn-common.c
(brasero_libburn_common_ctx_free),
(brasero_libburn_common_ctx_new),
(brasero_libburn_common_status_changed),
(brasero_libburn_common_status):
* src/plugins/libburnia/burn-libburn-common.h:
* src/plugins/libburnia/burn-libburn.c
(brasero_libburn_src_free_data), (brasero_libburn_src_get_size),
(brasero_libburn_src_set_size), (brasero_libburn_src_read_xt),
(brasero_libburn_create_fd_source), (brasero_libburn_add_fd_track),
(brasero_libburn_add_file_track),
(brasero_libburn_setup_session_fd),
(brasero_libburn_setup_session_file),
(brasero_libburn_start_record), (brasero_libburn_start_erase),
(brasero_libburn_stop), (brasero_libburn_clock_tick),
(brasero_libburn_finalize), (brasero_libburn_export_caps):
* src/plugins/libburnia/burn-libisofs.c
(brasero_libisofs_create_image), (brasero_libisofs_import_read),
(brasero_libisofs_import_open), (brasero_libisofs_import_close),
(brasero_libisofs_import_free),
(brasero_libisofs_import_last_session),
(brasero_libisofs_create_volume_thread),
(brasero_libisofs_create_volume), (brasero_libisofs_stop_real),
(brasero_libisofs_clean_output), (brasero_libisofs_export_caps):
2008-05-12 Philippe Rouquier <algernon@localhost.localdomain>
Fix #519339 – [libburnia] Doesn't build with libisofs 0.6.2 and wrong pkg-config filename for libburn
......
......@@ -95,6 +95,8 @@ GSTREAMER_REQUIRED=0.10.6
GSTREAMER_BASE_REQUIRED=0.10.0
LIBXML2_REQUIRED=2.6.0
HAL_REQUIRED=0.5
DBUS_REQUIRED=0.7.2
GNOME_DOC_INIT
dnl ** used by brasero and one plugin
......@@ -137,7 +139,8 @@ PKG_CHECK_MODULES(BRASERO, \
gtk+-2.0 >= $GTK_REQUIRED \
libgnome-2.0 >= $LIBGNOME_REQUIRED \
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
libxml-2.0 >= $LIBXML2_REQUIRED)
libxml-2.0 >= $LIBXML2_REQUIRED \
dbus-glib-1 >= $DBUS_REQUIRED)
AC_SUBST(BRASERO_CFLAGS)
AC_SUBST(BRASERO_LIBS)
......@@ -193,24 +196,25 @@ fi
AM_CONDITIONAL(BUILD_CDRKIT, test x"$build_cdrkit" = "xyes")
dnl ****************check for libnotify (optional)**************
LIBNOTIFY_REQUIRED=0.3.0
AC_ARG_ENABLE(libnotify,
[ --enable-libnotify use libnotify if available [[default = yes]]],,
[enable_libnotify="yes"])
if test x"$enable_libnotify" = "xyes"; then
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED, build_libnotify=yes, build_libnotify=no)
else
build_libnotify="no"
fi
if test x"$build_libnotify" = "xyes"; then
BRASERO_CFLAGS="$BRASERO_CFLAGS $LIBNOTIFY_CFLAGS"
BRASERO_LIBS="$BRASERO_LIBS $LIBNOTIFY_LIBS"
AC_DEFINE(HAVE_LIBNOTIFY, 1, [define if you want to use with libnotify support])
fi
AM_CONDITIONAL(HAVE_LIBNOTIFY, test x"$build_libnotify" = "xyes")
dnl disable because not used any more
dnl LIBNOTIFY_REQUIRED=0.3.0
dnl AC_ARG_ENABLE(libnotify,
dnl [ --enable-libnotify use libnotify if available [[default = yes]]],,
dnl [enable_libnotify="yes"])
dnl if test x"$enable_libnotify" = "xyes"; then
dnl PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED, build_libnotify=yes, build_libnotify=no)
dnl else
dnl build_libnotify="no"
dnl fi
dnl if test x"$build_libnotify" = "xyes"; then
dnl BRASERO_CFLAGS="$BRASERO_CFLAGS $LIBNOTIFY_CFLAGS"
dnl BRASERO_LIBS="$BRASERO_LIBS $LIBNOTIFY_LIBS"
dnl AC_DEFINE(HAVE_LIBNOTIFY, 1, [define if you want to use with libnotify support])
dnl fi
dnl AM_CONDITIONAL(HAVE_LIBNOTIFY, test x"$build_libnotify" = "xyes")
dnl ****************check for search (optional)**************
BEAGLE_REQUIRED=0.3.0
......@@ -252,27 +256,6 @@ if test x"$build_totem" = "xyes"; then
fi
AM_CONDITIONAL(BUILD_PLAYLIST, test x"$build_totem" = "xyes")
dnl ****************check for dbus (optional)**************
DBUS_REQUIRED=0.7.2
AC_ARG_ENABLE(dbus,
[ --enable-dbus build dbus (if Gnome Power Manager is available)[[default = yes]]],,
[enable_dbus="yes"])
if test x"$enable_dbus" = "xyes"; then
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_REQUIRED, build_dbus=yes, build_dbus=no)
else
build_dbus="no"
fi
if test x"$build_dbus" = "xyes"; then
BRASERO_CFLAGS="$BRASERO_CFLAGS $DBUS_CFLAGS"
BRASERO_LIBS="$BRASERO_LIBS $DBUS_LIBS"
AC_DEFINE(BUILD_DBUS, 1, [define if you want to build dbus])
fi
AM_CONDITIONAL(BUILD_PLAYLIST, test x"$build_dbus" = "xyes")
dnl ****************check for preview (optional)**************
GSTREAMER_MODULE_REQUIRED=0.10.0
AC_ARG_ENABLE(preview,
......@@ -365,14 +348,14 @@ echo
echo "$PACKAGE configuration summary:"
echo "----------------------------------"
dnl Build libnotify support : ${build_libnotify}
echo "Version: $BRASERO_VERSION
Update caches: ${enable_caches}
Build inotify: ${enable_inotify}
Build search pane : ${build_beagle}
Build playlist pane : ${build_totem}
Build Preview pane : ${enable_preview}
Build libnotify support : ${build_libnotify}
Build dbus support : ${build_dbus}
Build cdrtools plugins : ${build_cdrtools}
Build cdrkit plugins : ${build_cdrkit}
Build libburnia plugins : ${build_libburnia}
......
......@@ -255,7 +255,9 @@ brasero_SOURCES = \
brasero-multi-song-props.h \
brasero-multi-song-props.c \
brasero-rename.h \
brasero-rename.c
brasero-rename.c \
brasero-notify.c \
brasero-notify.h
if BUILD_INOTIFY
brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h
......
......@@ -406,12 +406,15 @@ brasero_async_task_manager_foreach_active_remove (BraseroAsyncTaskManager *self,
}
}
while (tasks) {
while (tasks && self->priv->active_tasks) {
GSList *next;
/* Now we wait for all these active tasks to be finished */
g_cond_wait (self->priv->task_finished, self->priv->lock);
for (iter = tasks; iter; iter = iter->next) {
for (iter = tasks; iter; iter = next) {
ctx = iter->data;
next = iter->next;
if (g_slist_find (self->priv->active_tasks, ctx))
continue;
......@@ -420,7 +423,6 @@ brasero_async_task_manager_foreach_active_remove (BraseroAsyncTaskManager *self,
/* NOTE: no need to call destroy callback here
* since it was done in the thread loop. */
break;
}
}
......
......@@ -118,7 +118,9 @@ static void
brasero_audio_disc_reset (BraseroDisc *disc);
static guint
brasero_audio_disc_add_ui (BraseroDisc *disc, GtkUIManager *manager);
brasero_audio_disc_add_ui (BraseroDisc *disc,
GtkUIManager *manager,
GtkWidget *message);
static gboolean
brasero_audio_disc_button_pressed_cb (GtkTreeView *tree,
......@@ -493,7 +495,9 @@ brasero_audio_disc_set_property (GObject * object,
}
static guint
brasero_audio_disc_add_ui (BraseroDisc *disc, GtkUIManager *manager)
brasero_audio_disc_add_ui (BraseroDisc *disc,
GtkUIManager *manager,
GtkWidget *message)
{
BraseroAudioDisc *audio_disc;
GError *error = NULL;
......
......@@ -78,25 +78,18 @@ static void
brasero_burn_dialog_tray_show_dialog_cb (BraseroTrayIcon *tray,
gboolean show,
GtkWidget *dialog);
static void
brasero_burn_dialog_tray_close_after_cb (BraseroTrayIcon *tray,
gboolean close,
BraseroBurnDialog *dialog);
struct BraseroBurnDialogPrivate {
BraseroBurn *burn;
BraseroTrackType input;
BraseroBurnSession *session;
GtkWidget *close_check;
GtkWidget *progress;
GtkWidget *header;
GtkWidget *cancel;
GtkWidget *image;
BraseroTrayIcon *tray;
gint close_timeout;
guint is_writing:1;
};
......@@ -1064,10 +1057,6 @@ brasero_burn_dialog_init (BraseroBurnDialog * obj)
"show-dialog",
G_CALLBACK (brasero_burn_dialog_tray_show_dialog_cb),
obj);
g_signal_connect (obj->priv->tray,
"close-after",
G_CALLBACK (brasero_burn_dialog_tray_close_after_cb),
obj);
alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
gtk_widget_show (alignment);
......@@ -1104,14 +1093,6 @@ brasero_burn_dialog_init (BraseroBurnDialog * obj)
FALSE,
0);
obj->priv->close_check = gtk_check_button_new_with_mnemonic (_("_Close the application if the burn process is successful"));
gtk_widget_show (obj->priv->close_check);
gtk_box_pack_end (GTK_BOX (obj->priv->progress),
obj->priv->close_check,
FALSE,
FALSE,
0);
/* buttons */
obj->priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_widget_show (obj->priv->cancel);
......@@ -1154,11 +1135,6 @@ brasero_burn_dialog_finalize (GObject * object)
cobj->priv->tray = NULL;
}
if (cobj->priv->close_timeout) {
g_source_remove (cobj->priv->close_timeout);
cobj->priv->close_timeout = 0;
}
if (cobj->priv->session) {
g_object_unref (cobj->priv->session);
cobj->priv->session = NULL;
......@@ -1576,34 +1552,12 @@ brasero_burn_dialog_notify_error (BraseroBurnDialog *dialog,
gtk_widget_destroy (message);
}
static gboolean
brasero_burn_dialog_success_timeout (BraseroBurnDialog *dialog)
{
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
dialog->priv->close_timeout = 0;
return FALSE;
}
static void
brasero_burn_dialog_success_run (BraseroBurnDialog *dialog)
{
gint answer;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check))) {
dialog->priv->close_timeout = g_timeout_add (TIMEOUT,
(GSourceFunc) brasero_burn_dialog_success_timeout,
dialog);
}
answer = gtk_dialog_run (GTK_DIALOG (dialog));
/* remove the timeout if need be */
if (dialog->priv->close_timeout) {
g_source_remove (dialog->priv->close_timeout);
dialog->priv->close_timeout = 0;
}
if (answer == GTK_RESPONSE_CLOSE) {
GtkWidget *contents;
GtkWidget *window;
......@@ -1757,8 +1711,6 @@ brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
BraseroBurnResult result,
GError *error)
{
gboolean close_dialog;
if (dialog->priv->burn) {
g_object_unref (dialog->priv->burn);
dialog->priv->burn = NULL;
......@@ -1768,10 +1720,8 @@ brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
if (result == BRASERO_BURN_CANCEL) {
/* nothing to do */
close_dialog = FALSE;
}
else if (error || result != BRASERO_BURN_OK) {
close_dialog = FALSE;
brasero_burn_dialog_notify_error (dialog, error);
}
else {
......@@ -1789,10 +1739,9 @@ brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
}
brasero_burn_dialog_notify_success (dialog);
close_dialog = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check));
}
return close_dialog;
return FALSE;
}
gboolean
......@@ -1958,11 +1907,3 @@ brasero_burn_dialog_tray_show_dialog_cb (BraseroTrayIcon *tray,
else
gtk_widget_hide (dialog);
}
static void
brasero_burn_dialog_tray_close_after_cb (BraseroTrayIcon *tray,
gboolean close,
BraseroBurnDialog *dialog)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->close_check), close);
}
......@@ -48,13 +48,6 @@
#include <gtk/gtknotebook.h>
#include <gtk/gtksizegroup.h>
#ifdef HAVE_LIBNOTIFY
#include <libnotify/notification.h>
#endif
#include "eggtreemultidnd.h"
#include "baobab-cell-renderer-progress.h"
......@@ -69,6 +62,7 @@
#include "brasero-utils.h"
#include "brasero-disc-message.h"
#include "brasero-rename.h"
#include "brasero-notify.h"
#include "burn-debug.h"
#include "burn-basics.h"
......@@ -83,6 +77,7 @@ struct _BraseroDataDiscPrivate
GtkWidget *filter;
BraseroDataProject *project;
GtkWidget *notebook;
GtkWidget *message;
GtkUIManager *manager;
......@@ -93,19 +88,10 @@ struct _BraseroDataDiscPrivate
BraseroFileNode *selected;
#ifdef HAVE_LIBNOTIFY
NotifyNotification *notification;
#endif
GSList *load_errors;
guint loading;
GSList *libnotify;
guint libnotify_id;
guint editing:1;
guint reject_files:1;
......@@ -211,129 +197,6 @@ G_DEFINE_TYPE_WITH_CODE (BraseroDataDisc,
G_IMPLEMENT_INTERFACE (BRASERO_TYPE_DISC,
brasero_data_disc_iface_disc_init));
/**
* Notifications
*/
struct _BraseroNotification {
gchar *primary;
gchar *secondary;
GtkWidget *widget;
};
typedef struct _BraseroNotification BraseroNotification;
static void
brasero_data_disc_notification_free (BraseroNotification *notification)
{
g_free (notification->primary);
g_free (notification->secondary);
g_object_unref (notification->widget);
g_free (notification);
}
#ifdef HAVE_LIBNOTIFY
static void
brasero_data_disc_notification_closed (NotifyNotification *notification,
BraseroDataDisc *disc)
{
BraseroDataDiscPrivate *priv;
priv = BRASERO_DATA_DISC_PRIVATE (disc);
g_object_unref (notification);
priv->notification = NULL;
}
#endif
static gboolean
brasero_data_disc_notify_user_real (gpointer data)
{
BraseroNotification *notification;
BraseroDataDiscPrivate *priv;
BraseroDataDisc *disc;
disc = data;
priv = BRASERO_DATA_DISC_PRIVATE (disc);
if (!priv->libnotify) {
priv->libnotify_id = 0;
return FALSE;
}
notification = priv->libnotify->data;
#ifdef HAVE_LIBNOTIFY
GtkWidget *toplevel;
/* see if we should notify the user. What we want to avoid is to have
* two notifications at the same time */
NotifyNotification *notify;
/* see if the previous notification has finished to be displayed */
if (priv->notification)
return TRUE;
/* is the widget ready and is the toplevel window active */
toplevel = gtk_widget_get_toplevel (notification->widget);
if (!GTK_WIDGET_REALIZED (notification->widget)
|| !gtk_window_has_toplevel_focus (GTK_WINDOW (toplevel)))
return TRUE;
/* Good to go */
notify = notify_notification_new (notification->primary,
notification->secondary,
NULL,
notification->widget);
notify_notification_set_timeout (notify, 5000);
g_signal_connect (notify,
"closed",
G_CALLBACK (brasero_data_disc_notification_closed),
disc);
notify_notification_show (notify, NULL);
priv->notification = notify;
#endif
priv->libnotify = g_slist_remove (priv->libnotify, notification);
brasero_data_disc_notification_free (notification);
return TRUE;
}
static void
brasero_data_disc_notify_user (BraseroDataDisc *disc,
const gchar *primary_message,
const gchar *secondary_message,
GtkWidget *focus)
{
BraseroNotification *notification;
BraseroDataDiscPrivate *priv;
priv = BRASERO_DATA_DISC_PRIVATE (disc);
/* if the widget doesn't even exist, no need to display a notification */
if (!focus)
return;
/* we delay notifications since they are sometimes generated just before
* a widget is shown and therefore appear in the right corner and not
* focused on the widget */
notification = g_new0 (BraseroNotification, 1);
notification->primary = g_strdup (primary_message);
notification->secondary = g_strdup (secondary_message);
notification->widget = focus;
g_object_ref (focus);
priv->libnotify = g_slist_prepend (priv->libnotify, notification);
if (!priv->libnotify_id)
priv->libnotify_id = g_timeout_add (500,
brasero_data_disc_notify_user_real,
disc);
}
/**
* Actions callbacks
*/
......@@ -362,25 +225,49 @@ brasero_data_disc_import_failure_dialog (BraseroDataDisc *disc,
gtk_widget_destroy (dialog);
}
static void
brasero_data_disc_import_session_cb (GtkToggleAction *action,
BraseroDataDisc *disc)
static gboolean
brasero_data_disc_import_session (BraseroDataDisc *disc,
gboolean import)
{
BraseroDataDiscPrivate *priv;
priv = BRASERO_DATA_DISC_PRIVATE (disc);
if (gtk_toggle_action_get_active (action)) {
if (import) {
GError *error = NULL;
if (!brasero_data_session_add_last (BRASERO_DATA_SESSION (priv->project), &error)) {
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
brasero_data_disc_import_failure_dialog (disc, error);
return FALSE;
}
else
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 1);
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 1);
return TRUE;
}
brasero_data_session_remove_last (BRASERO_DATA_SESSION (priv->project));
return FALSE;
}
static void
brasero_data_disc_import_session_cb (GtkToggleAction *action,
BraseroDataDisc *disc)
{
BraseroDataDiscPrivate *priv;
gboolean res;
priv = BRASERO_DATA_DISC_PRIVATE (disc);
brasero_notify_message_remove (BRASERO_NOTIFY (priv->message), BRASERO_NOTIFY_CONTEXT_MULTISESSION);
res = brasero_data_disc_import_session (disc, gtk_toggle_action_get_active (action));
/* make sure the button reflects the current state */
if (gtk_toggle_action_get_active (action) != res) {
g_signal_handlers_block_by_func (action, brasero_data_disc_import_session_cb, disc);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), res);
g_signal_handlers_unblock_by_func (action, brasero_data_disc_import_session_cb, disc);
}
else
brasero_data_session_remove_last (BRASERO_DATA_SESSION (priv->project));
}
static BraseroFileNode *
......@@ -694,37 +581,44 @@ brasero_data_disc_project_loaded_cb (BraseroDataProject *project,
BraseroDataDisc *self)
{
BraseroDataDiscPrivate *priv;
GtkWidget *message;
priv = BRASERO_DATA_DISC_PRIVATE (self);
message = brasero_notify_get_message_by_context_id (BRASERO_NOTIFY (priv->message), BRASERO_NOTIFY_CONTEXT_LOADING);
if (!message)
return;
if (loading > 0) {
/* we're not done yet update progress. */
brasero_disc_message_set_progress (BRASERO_DISC_MESSAGE (priv->message),
brasero_disc_message_set_progress (BRASERO_DISC_MESSAGE (message),
(gdouble) (priv->loading - loading) / (gdouble) priv->loading);
return;
}
priv->loading = 0;
if (priv->load_errors) {
brasero_disc_message_remove_buttons (BRASERO_DISC_MESSAGE (priv->message));
brasero_disc_message_remove_buttons (BRASERO_DISC_MESSAGE (message));
brasero_disc_message_set_primary (BRASERO_DISC_MESSAGE (priv->message),
brasero_disc_message_set_primary (BRASERO_DISC_MESSAGE (message),
_("The contents of the project changed since it was saved:"));
brasero_disc_message_set_secondary (BRASERO_DISC_MESSAGE (priv->message),
brasero_disc_message_set_secondary (BRASERO_DISC_MESSAGE (message),
_("Do you want to continue or discard it?"));
brasero_disc_message_set_image (BRASERO_DISC_MESSAGE (priv->message),GTK_STOCK_DIALOG_WARNING);
brasero_disc_message_set_progress_active (BRASERO_DISC_MESSAGE (priv->message), FALSE);
brasero_disc_message_add_button (BRASERO_DISC_MESSAGE (priv->message),
_("_Discard"),
_("Press if you want to discard the current modified project"),
GTK_RESPONSE_CANCEL);
brasero_disc_message_add_button (BRASERO_DISC_MESSAGE (priv->message),
_("_Continue"),
_("Press if you want to continue with the current modified project"),
GTK_RESPONSE_OK);
brasero_disc_message_add_errors (BRASERO_DISC_MESSAGE (priv->message),
brasero_disc_message_set_image (BRASERO_DISC_MESSAGE (message),GTK_STOCK_DIALOG_WARNING);
brasero_disc_message_set_progress_active (BRASERO_DISC_MESSAGE (message), FALSE);
brasero_notify_button_add (BRASERO_NOTIFY (priv->message),
BRASERO_DISC_MESSAGE (message),
_("_Discard"),
_("Press if you want to discard the current modified project"),
GTK_RESPONSE_CANCEL);
brasero_notify_button_add (BRASERO_NOTIFY (priv->message),
BRASERO_DISC_MESSAGE (message),
_("_Continue"),
_("Press if you want to continue with the current modified project"),
GTK_RESPONSE_OK);
brasero_disc_message_add_errors (BRASERO_DISC_MESSAGE (message),
priv->load_errors);
g_slist_foreach (priv->load_errors, (GFunc) g_free , NULL);
g_slist_free (priv->load_errors);
......@@ -734,7 +628,7 @@ brasero_data_disc_project_loaded_cb (BraseroDataProject *project,
gtk_widget_set_sensitive (GTK_WIDGET (priv->tree), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (priv->filter), TRUE);
gtk_widget_hide (priv->message);
gtk_widget_destroy (message);
}
priv->loading = FALSE;
......@@ -1091,6 +985,28 @@ brasero_data_disc_size_changed_cb (BraseroDataProject *project,
brasero_disc_size_changed (BRASERO_DISC (self), size);
}
static void
brasero_disc_disc_session_import_response_cb (GtkButton *button,
GtkResponseType response,
BraseroDataDisc *self)
{
gboolean res;
GtkAction *action;
BraseroDataDiscPrivate *priv;
if (response != GTK_RESPONSE_OK)
return;
priv = BRASERO_DATA_DISC_PRIVATE (self);
res = brasero_data_disc_import_session (self, TRUE);
action = gtk_action_group_get_action (priv->disc_group, "ImportSession");
g_signal_handlers_block_by_func (action, brasero_data_disc_import_session_cb, self);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), res);
g_signal_handlers_unblock_by_func (action, brasero_data_disc_import_session_cb, self);
}
static void