brasero r1573 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1573 - in trunk: . src
- Date: Thu, 27 Nov 2008 20:00:27 +0000 (UTC)
Author: philippr
Date: Thu Nov 27 20:00:27 2008
New Revision: 1573
URL: http://svn.gnome.org/viewvc/brasero?rev=1573&view=rev
Log:
Fix #559107 â Never resume last used project by default
Instead of loading automatically the last unburnt project, add a button
in the recent projects/files pane for the user to load it in one click
if he wants to
* src/brasero-app.c (brasero_app_run):
* src/brasero-app.h:
* src/brasero-project-manager.c
(brasero_project_manager_last_saved_clicked_cb),
(brasero_project_manager_init):
* src/brasero-project-type-chooser.c
(brasero_project_type_chooser_last_unsaved_clicked_cb),
(brasero_project_type_chooser_build_recent),
(brasero_project_type_chooser_class_init):
* src/brasero-project-type-chooser.h:
* src/brasero-session.c (brasero_session_load):
* src/brasero-session.h:
* src/main.c (brasero_app_parse_options):
Modified:
trunk/ChangeLog
trunk/src/brasero-app.c
trunk/src/brasero-app.h
trunk/src/brasero-project-manager.c
trunk/src/brasero-project-type-chooser.c
trunk/src/brasero-project-type-chooser.h
trunk/src/brasero-session.c
trunk/src/brasero-session.h
trunk/src/main.c
Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c (original)
+++ trunk/src/brasero-app.c Thu Nov 27 20:00:27 2008
@@ -348,7 +348,7 @@
}
void
-brasero_app_run (BraseroApp *app, gboolean load_default_project)
+brasero_app_run (BraseroApp *app)
{
BraseroAppPrivate *priv;
@@ -356,7 +356,7 @@
priv->is_running = TRUE;
gtk_widget_realize (GTK_WIDGET (app));
- brasero_session_load (app, load_default_project);
+ brasero_session_load (app);
}
void
Modified: trunk/src/brasero-app.h
==============================================================================
--- trunk/src/brasero-app.h (original)
+++ trunk/src/brasero-app.h Thu Nov 27 20:00:27 2008
@@ -52,8 +52,7 @@
brasero_app_new (void);
void
-brasero_app_run (BraseroApp *app,
- gboolean load_default_project);
+brasero_app_run (BraseroApp *app);
gboolean
brasero_app_is_running (BraseroApp *app);
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Thu Nov 27 20:00:27 2008
@@ -1175,6 +1175,14 @@
return TRUE;
}
+static void
+brasero_project_manager_last_saved_clicked_cb (BraseroProjectTypeChooser *chooser,
+ const gchar *path,
+ BraseroProjectManager *manager)
+{
+ brasero_project_manager_load_session (manager, path);
+}
+
gboolean
brasero_project_manager_save_session (BraseroProjectManager *manager,
const gchar *path,
@@ -1237,6 +1245,10 @@
"recent-clicked",
G_CALLBACK (brasero_project_manager_recent_clicked_cb),
obj);
+ g_signal_connect (type,
+ "last-saved",
+ G_CALLBACK (brasero_project_manager_last_saved_clicked_cb),
+ obj);
gtk_notebook_prepend_page (GTK_NOTEBOOK (obj), type, NULL);
/* add the layout */
Modified: trunk/src/brasero-project-type-chooser.c
==============================================================================
--- trunk/src/brasero-project-type-chooser.c (original)
+++ trunk/src/brasero-project-type-chooser.c Thu Nov 27 20:00:27 2008
@@ -31,17 +31,20 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "brasero-project-type-chooser.h"
#include "brasero-utils.h"
+#include "brasero-session.h"
G_DEFINE_TYPE (BraseroProjectTypeChooser, brasero_project_type_chooser, GTK_TYPE_EVENT_BOX);
typedef enum {
+ LAST_SAVED_CLICKED_SIGNAL,
RECENT_CLICKED_SIGNAL,
CHOSEN_SIGNAL,
LAST_SIGNAL
@@ -188,6 +191,25 @@
uri);
}
+static void
+brasero_project_type_chooser_last_unsaved_clicked_cb (GtkButton *button,
+ BraseroProjectTypeChooser *self)
+{
+ const gchar *uri;
+ gchar *path;
+
+ uri = gtk_link_button_get_uri (GTK_LINK_BUTTON (button));
+ path = g_filename_from_uri (uri, NULL, NULL);
+
+ g_signal_emit (self,
+ brasero_project_type_chooser_signals [LAST_SAVED_CLICKED_SIGNAL],
+ 0,
+ path);
+
+ g_remove (path);
+ g_free (path);
+}
+
static gint
brasero_project_type_chooser_sort_recent (gconstpointer a, gconstpointer b)
{
@@ -210,8 +232,10 @@
brasero_project_type_chooser_build_recent (BraseroProjectTypeChooser *self,
GtkRecentManager *recent)
{
+ GtkSizeGroup *image_group;
GtkSizeGroup *group;
GList *list = NULL;
+ gchar *filename;
GList *recents;
GList *iter;
@@ -246,6 +270,51 @@
}
group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ image_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+
+ /* If a project was left unfinished last time then add another entry */
+ filename = g_build_filename (g_get_user_config_dir (),
+ "brasero",
+ BRASERO_SESSION_TMP_PROJECT_PATH,
+ NULL);
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ gchar *uri;
+ GtkWidget *link;
+ GtkWidget *hbox;
+ GtkWidget *image;
+
+ uri = g_filename_to_uri (filename, NULL, NULL);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (self->priv->recent_box),
+ hbox,
+ FALSE,
+ TRUE,
+ 0);
+
+ image = gtk_image_new_from_icon_name ("brasero", GTK_ICON_SIZE_BUTTON);
+ gtk_size_group_add_widget (image_group, image);
+
+ link = gtk_link_button_new_with_label (uri, _("Last _Unsaved Project"));
+ gtk_button_set_alignment (GTK_BUTTON (link), 0.0, 0.5);
+ gtk_button_set_focus_on_click (GTK_BUTTON (link), FALSE);
+ gtk_button_set_image (GTK_BUTTON (link), image);
+ g_signal_connect (link,
+ "clicked",
+ G_CALLBACK (brasero_project_type_chooser_last_unsaved_clicked_cb),
+ self);
+
+ gtk_widget_show (link);
+ gtk_widget_set_tooltip_text (link, _("Load the last project that was not burnt and not saved"));
+ gtk_box_pack_start (GTK_BOX (hbox), link, FALSE, TRUE, 0);
+
+ g_free (uri);
+
+ gtk_size_group_add_widget (group, link);
+ }
+ g_free (filename);
+
for (iter = list; iter; iter = iter->next) {
GtkRecentInfo *info;
const gchar *name;
@@ -271,6 +340,7 @@
pixbuf = gtk_recent_info_get_icon (info, GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
+ gtk_size_group_add_widget (image_group, image);
gtk_widget_show (image);
gtk_widget_set_tooltip_text (image, tooltip);
@@ -512,6 +582,15 @@
G_TYPE_NONE,
1,
G_TYPE_STRING);
+ brasero_project_type_chooser_signals[LAST_SAVED_CLICKED_SIGNAL] =
+ g_signal_new ("last_saved", G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_ACTION | G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (BraseroProjectTypeChooserClass, last_saved_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
}
GtkWidget *
Modified: trunk/src/brasero-project-type-chooser.h
==============================================================================
--- trunk/src/brasero-project-type-chooser.h (original)
+++ trunk/src/brasero-project-type-chooser.h Thu Nov 27 20:00:27 2008
@@ -60,6 +60,8 @@
typedef struct {
GtkEventBoxClass parent_class;
+ void (*last_saved_clicked) (BraseroProjectTypeChooser *chooser,
+ const gchar *path);
void (*recent_clicked) (BraseroProjectTypeChooser *chooser,
const gchar *uri);
void (*chosen) (BraseroProjectTypeChooser *chooser,
Modified: trunk/src/brasero-session.c
==============================================================================
--- trunk/src/brasero-session.c (original)
+++ trunk/src/brasero-session.c Thu Nov 27 20:00:27 2008
@@ -64,14 +64,12 @@
}
gboolean
-brasero_session_load (BraseroApp *app, gboolean load_project)
+brasero_session_load (BraseroApp *app)
{
gchar *height_str = NULL;
gchar *width_str = NULL;
gchar *state_str = NULL;
gchar *version = NULL;
- gchar *project_path;
- GtkWidget *manager;
gint height;
gint width;
gint state = 0;
@@ -184,23 +182,6 @@
if (state)
gtk_window_maximize (GTK_WINDOW (app));
- /* now we start the project if any */
- project_path = brasero_session_get_path (BRASERO_SESSION_TMP_PROJECT_PATH);
- if (!load_project
- || !g_file_test (project_path,G_FILE_TEST_EXISTS)) {
- g_free (project_path);
- project_path = NULL;
- }
-
- manager = brasero_app_get_project_manager (app);
- brasero_project_manager_load_session (BRASERO_PROJECT_MANAGER (manager), project_path);
-
- if (project_path) {
- /* remove the project file not to have it next time */
- g_remove (project_path);
- g_free (project_path);
- }
-
return TRUE;
}
Modified: trunk/src/brasero-session.h
==============================================================================
--- trunk/src/brasero-session.h (original)
+++ trunk/src/brasero-session.h Thu Nov 27 20:00:27 2008
@@ -46,7 +46,7 @@
gboolean save_project,
gboolean cancellable);
gboolean
-brasero_session_load (BraseroApp *app, gboolean load_project);
+brasero_session_load (BraseroApp *app);
G_END_DECLS
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Thu Nov 27 20:00:27 2008
@@ -179,7 +179,7 @@
if (empty_project) {
brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
return;
}
@@ -207,7 +207,7 @@
nb ++;
if (nb > 1) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
brasero_app_alert (app,
_("Incompatible command line options used."),
@@ -238,7 +238,7 @@
}
else if (project_uri) {
brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_project, project_uri);
}
else if (burn_project_uri) {
@@ -341,22 +341,22 @@
#ifdef BUILD_PLAYLIST
else if (playlist_uri) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_playlist, playlist_uri);
}
#endif
else if (audio_project) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_audio, files);
}
else if (data_project) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
}
else if (video_project) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_video, files);
}
else if (disc_blank) {
@@ -388,7 +388,7 @@
return;
}
else if (files) {
- brasero_app_run (app, FALSE);
+ brasero_app_run (app);
if (g_strv_length (files) == 1) {
BraseroProjectType type;
@@ -407,7 +407,7 @@
}
else {
brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
- brasero_app_run (app, TRUE);
+ brasero_app_run (app);
}
gtk_widget_show (GTK_WIDGET (app));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]