brasero r1186 - in trunk: . po src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1186 - in trunk: . po src
- Date: Wed, 27 Aug 2008 12:49:16 +0000 (UTC)
Author: philippr
Date: Wed Aug 27 12:49:16 2008
New Revision: 1186
URL: http://svn.gnome.org/viewvc/brasero?rev=1186&view=rev
Log:
Created a new BraseroApp object type
* src/Makefile.am:
* src/brasero-app.h:
* src/brasero-project-manager.c
(brasero_project_manager_set_statusbar),
(brasero_project_manager_selected_uris_changed),
(brasero_project_manager_switch):
* src/brasero-project-manager.h:
* src/brasero-session.c (brasero_session_load),
(brasero_session_save):
* src/main.c (brasero_app_parse_options), (main):
Modified:
trunk/ChangeLog
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/brasero-app.h
trunk/src/brasero-project-manager.c
trunk/src/brasero-project-manager.h
trunk/src/brasero-session.c
trunk/src/main.c
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Wed Aug 27 12:49:16 2008
@@ -1,6 +1,7 @@
# List of source files containing translatable strings.
[encoding: UTF-8]
+src/brasero-app.c
data/brasero.desktop.in.in
data/brasero.schemas.in
data/brasero.xml.in
@@ -8,7 +9,6 @@
src/brasero-audio-disc.c
src/brasero-blank-dialog.c
src/brasero-disc-copy-dialog.c
-src/brasero-menu.h
src/brasero-metadata.c
src/brasero-mime-filter.c
src/brasero-playlist.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Aug 27 12:49:16 2008
@@ -47,7 +47,6 @@
brasero-playlist.h \
brasero-player.c \
brasero-player.h \
- brasero-menu.h \
brasero-burn-dialog.c \
brasero-burn-dialog.h \
brasero-disc-copy-dialog.c \
@@ -86,7 +85,6 @@
burn-caps.h \
brasero-session.c \
brasero-session.h \
- brasero-app.h \
brasero-uri-container.c \
brasero-uri-container.h \
brasero-project-manager.c \
@@ -270,7 +268,9 @@
scsi-write-page.h \
scsi-mode-select.c \
scsi-read10.c \
- scsi-sbc.h
+ scsi-sbc.h \
+ brasero-app.c \
+ brasero-app.h
if BUILD_INOTIFY
brasero_SOURCES += brasero-file-monitor.c brasero-file-monitor.h
@@ -294,98 +294,3 @@
brasero_LDADD = \
$(BRASERO_LIBS) $(BRASERO_LIBXML_LIBS)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: trunk/src/brasero-app.h
==============================================================================
--- trunk/src/brasero-app.h (original)
+++ trunk/src/brasero-app.h Wed Aug 27 12:49:16 2008
@@ -1,57 +1,72 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
- * Brasero 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
+ * Brasero
+ * Copyright (C) Philippe Rouquier 2008 <bonfire-app wanadoo fr>
+ *
+ * Brasero 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 3 of the License, or
* (at your option) any later version.
*
- * Brasero 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.
+ * Brasero 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 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.,
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-/***************************************************************************
- * brasero-app.h
- *
- * Fri May 19 08:44:18 2006
- * Copyright 2006 Philippe Rouquier
- * <brasero-app wanadoo fr>
- ****************************************************************************/
-
-#ifndef _BRASERO_APP_H
-#define _BRASERO_APP_H
-#include <glib.h>
+#ifndef _BRASERO_APP_H_
+#define _BRASERO_APP_H_
-#include <gtk/gtkuimanager.h>
+#include <glib-object.h>
G_BEGIN_DECLS
-struct _BraseroApp {
- GtkWidget *mainwin;
- GtkWidget *contents;
- GtkWidget *statusbar;
- GtkUIManager *manager;
+#define BRASERO_TYPE_APP (brasero_app_get_type ())
+#define BRASERO_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_APP, BraseroApp))
+#define BRASERO_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_APP, BraseroAppClass))
+#define BRASERO_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_APP))
+#define BRASERO_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_APP))
+#define BRASERO_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_APP, BraseroAppClass))
- guint tooltip_ctx;
+typedef struct _BraseroAppClass BraseroAppClass;
+typedef struct _BraseroApp BraseroApp;
- gint width;
- gint height;
+struct _BraseroAppClass
+{
+ GtkWindowClass parent_class;
+};
- gboolean is_maximised;
+struct _BraseroApp
+{
+ GtkWindow parent_instance;
};
-typedef struct _BraseroApp BraseroApp;
-G_END_DECLS
+GType brasero_app_get_type (void) G_GNUC_CONST;
-#endif /* _BRASERO_APP_H */
+GtkWidget *
+brasero_app_new (void);
+void
+brasero_app_blank (BraseroApp *app);
+void
+brasero_app_get_geometry (BraseroApp *app,
+ gint *width,
+ gint *height,
+ gboolean *maximised);
+
+GtkWidget *
+brasero_app_get_statusbar1 (BraseroApp *app);
+
+GtkWidget *
+brasero_app_get_statusbar2 (BraseroApp *app);
+
+GtkWidget *
+brasero_app_get_project_manager (BraseroApp *app);
+
+G_END_DECLS
-
+#endif /* _BRASERO_APP_H_ */
Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c (original)
+++ trunk/src/brasero-project-manager.c Wed Aug 27 12:49:16 2008
@@ -45,6 +45,7 @@
#include <gtk/gtkuimanager.h>
#include <gtk/gtkscrolledwindow.h>
+#include "brasero-app.h"
#include "brasero-utils.h"
#include "brasero-project.h"
#include "brasero-layout.h"
@@ -174,7 +175,6 @@
GtkWidget *project;
GtkWidget *layout;
- GtkWidget *status;
gchar **selected;
guint preview_id;
@@ -241,10 +241,18 @@
gint files_num)
{
gchar *status_string = NULL;
+ GtkWidget *toplevel;
+ GtkWidget *status;
gint valid_num;
- gtk_statusbar_pop (GTK_STATUSBAR (manager->priv->status),
- manager->priv->status_ctx);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ status = brasero_app_get_statusbar1 (BRASERO_APP (toplevel));
+
+ if (!manager->priv->status_ctx)
+ manager->priv->status_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (status),
+ "size_info");
+
+ gtk_statusbar_pop (GTK_STATUSBAR (status), manager->priv->status_ctx);
valid_num = files_num - invalid_num;
if (!invalid_num && valid_num) {
@@ -297,8 +305,7 @@
else
status_string = g_strdup (_("No file selected"));
- gtk_statusbar_push (GTK_STATUSBAR (manager->priv->status),
- manager->priv->status_ctx,
+ gtk_statusbar_push (GTK_STATUSBAR (status), manager->priv->status_ctx,
status_string);
g_free (status_string);
}
@@ -441,11 +448,20 @@
manager->priv->selected = uris;
if (!manager->priv->selected) {
- gtk_statusbar_pop (GTK_STATUSBAR (manager->priv->status),
- manager->priv->status_ctx);
- gtk_statusbar_push (GTK_STATUSBAR (manager->priv->status),
- manager->priv->status_ctx,
- _("No file selected"));
+ GtkWidget *toplevel;
+ GtkWidget *status;
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ status = brasero_app_get_statusbar1 (BRASERO_APP (toplevel));
+
+ if (!manager->priv->status_ctx)
+ manager->priv->status_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (status),
+ "size_info");
+
+ gtk_statusbar_pop (GTK_STATUSBAR (status), manager->priv->status_ctx);
+ gtk_statusbar_push (GTK_STATUSBAR (status),
+ manager->priv->status_ctx,
+ _("No file selected"));
return;
}
@@ -481,15 +497,6 @@
}
void
-brasero_project_manager_set_status (BraseroProjectManager *manager,
- GtkWidget *status)
-{
- manager->priv->status = status;
- manager->priv->status_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (status),
- "size_info");
-}
-
-void
brasero_project_manager_register_ui (BraseroProjectManager *manager,
GtkUIManager *ui_manager)
{
@@ -636,10 +643,15 @@
&& !brasero_project_confirm_switch (BRASERO_PROJECT (manager->priv->project)))
return;
- gtk_statusbar_pop (GTK_STATUSBAR (manager->priv->status),
- manager->priv->status_ctx);
-
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+
+ if (manager->priv->status_ctx) {
+ GtkWidget *status;
+
+ status = brasero_app_get_statusbar1 (BRASERO_APP (toplevel));
+ gtk_statusbar_pop (GTK_STATUSBAR (status), manager->priv->status_ctx);
+ }
+
action = gtk_action_group_get_action (manager->priv->action_group, "NewChoose");
manager->priv->type = type;
Modified: trunk/src/brasero-project-manager.h
==============================================================================
--- trunk/src/brasero-project-manager.h (original)
+++ trunk/src/brasero-project-manager.h Wed Aug 27 12:49:16 2008
@@ -104,9 +104,6 @@
void
brasero_project_manager_register_ui (BraseroProjectManager *manager,
GtkUIManager *ui_manager);
-void
-brasero_project_manager_set_status (BraseroProjectManager *manager,
- GtkWidget *status);
G_END_DECLS
Modified: trunk/src/brasero-session.c
==============================================================================
--- trunk/src/brasero-session.c (original)
+++ trunk/src/brasero-session.c Wed Aug 27 12:49:16 2008
@@ -71,6 +71,7 @@
gchar *state_str = NULL;
gchar *version = NULL;
gchar *project_path;
+ GtkWidget *manager;
gint height;
gint width;
gint state = 0;
@@ -85,9 +86,9 @@
/* Make sure that on first run the window has a default size of at least
* 85% of the screen (hardware not GTK+) */
- screen = gtk_window_get_screen (GTK_WINDOW (app->mainwin));
+ screen = gtk_window_get_screen (GTK_WINDOW (app));
monitor = gdk_screen_get_monitor_at_window (screen,
- GTK_WIDGET (app->mainwin)->window);
+ GTK_WIDGET (app)->window);
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
width = rect.width / 100 * 85;
height = rect.height / 100 * 85;
@@ -177,12 +178,12 @@
xmlFreeDoc (session);
- gtk_window_resize (GTK_WINDOW (app->mainwin),
+ gtk_window_resize (GTK_WINDOW (app),
width,
height);
if (state)
- gtk_window_maximize (GTK_WINDOW (app->mainwin));
+ gtk_window_maximize (GTK_WINDOW (app));
/* now we start the project if any */
project_path = brasero_session_get_path (BRASERO_SESSION_TMP_PROJECT_PATH);
@@ -192,8 +193,8 @@
project_path = NULL;
}
- brasero_project_manager_load_session (BRASERO_PROJECT_MANAGER (app->contents),
- project_path);
+ 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 */
@@ -209,8 +210,12 @@
gboolean save_project,
gboolean cancellable)
{
+ gint width;
+ gint height;
gint success;
gboolean cancel;
+ GtkWidget *manager;
+ gboolean maximised;
gchar *project_path;
gchar *session_path;
xmlTextWriter *session;
@@ -220,7 +225,8 @@
else
project_path = NULL;
- cancel = brasero_project_manager_save_session (BRASERO_PROJECT_MANAGER (app->contents),
+ manager = brasero_app_get_project_manager (app);
+ cancel = brasero_project_manager_save_session (BRASERO_PROJECT_MANAGER (manager),
project_path,
cancellable);
g_free (project_path);
@@ -262,24 +268,29 @@
if (success < 0)
goto error;
+ brasero_app_get_geometry (app,
+ &width,
+ &height,
+ &maximised);
+
success = xmlTextWriterWriteFormatElement (session,
(xmlChar *) "width",
"%i",
- app->width);
+ width);
if (success < 0)
goto error;
success = xmlTextWriterWriteFormatElement (session,
(xmlChar *) "height",
"%i",
- app->height);
+ height);
if (success < 0)
goto error;
success = xmlTextWriterWriteFormatElement (session,
(xmlChar *) "state",
"%i",
- app->is_maximised);
+ maximised);
if (success < 0)
goto error;
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Wed Aug 27 12:49:16 2008
@@ -47,21 +47,12 @@
#endif
-#include "brasero-app.h"
-#include "brasero-menu.h"
-#include "brasero-jacket-edit.h"
-#include "brasero-multi-dnd.h"
-#include "brasero-blank-dialog.h"
-#include "brasero-sum-dialog.h"
-#include "brasero-eject-dialog.h"
-#include "brasero-session.h"
#include "brasero-project-manager.h"
-#include "burn-drive.h"
-#include "brasero-pref.h"
+#include "brasero-multi-dnd.h"
+#include "brasero-utils.h"
+#include "brasero-app.h"
#include "burn-debug.h"
#include "burn.h"
-#include "burn-caps.h"
-#include "burn-plugin-manager.h"
gchar *project_uri;
gchar *playlist_uri;
@@ -72,7 +63,6 @@
gint copy_project;
gint empty_project;
gint disc_blank;
-gint is_escaped;
gint open_ncb;
gint debug;
@@ -128,21 +118,21 @@
{ NULL }
};
-#define BRASERO_PROJECT_OPEN_URI(app, function, path) \
+#define BRASERO_PROJECT_OPEN_URI(manager_MACRO, function, path) \
{ \
GFile *file; \
gchar *uri; \
file = g_file_new_for_commandline_arg (path); \
uri = g_file_get_uri (file); \
g_object_unref (file); \
- function (BRASERO_PROJECT_MANAGER (app->contents), uri); \
+ function (BRASERO_PROJECT_MANAGER (manager_MACRO), uri); \
}
-#define BRASERO_PROJECT_OPEN_LIST(app, function, uris) \
-{ \
- GSList *list = NULL; \
- gchar **iter; \
- /* convert all names into a GSList * */ \
+#define BRASERO_PROJECT_OPEN_LIST(manager_MACRO, function, uris) \
+{ \
+ GSList *list = NULL; \
+ gchar **iter; \
+ /* convert all names into a GSList * */ \
for (iter = uris; iter && *iter; iter ++) { \
gchar *uri; \
GFile *file; \
@@ -156,520 +146,17 @@
g_slist_free (list); \
}
-static gboolean
-on_delete_cb (GtkWidget *window, GdkEvent *event, BraseroApp *app)
-{
- return brasero_session_save (app, TRUE, TRUE);
-}
-
-static gboolean
-on_destroy_cb (GtkWidget *window, GdkEvent *event, BraseroApp *app)
-{
- gtk_main_quit ();
- return FALSE;
-}
-
-void
-on_exit_cb (GtkAction *action, BraseroApp *app)
-{
- if (brasero_session_save (app, TRUE, TRUE))
- return;
-
- gtk_widget_destroy (app->mainwin);
-}
-
-void
-on_erase_cb (GtkAction *action, BraseroApp *app)
-{
- GtkWidget *dialog;
- GtkWidget *toplevel;
-
- dialog = brasero_blank_dialog_new ();
- toplevel = gtk_widget_get_toplevel (app->mainwin);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
-
- gtk_widget_show (dialog);
-}
-
-void
-on_eject_cb (GtkAction *action, BraseroApp *app)
-{
- GtkWidget *dialog;
- GtkWidget *toplevel;
-
- dialog = brasero_eject_dialog_new();
- toplevel = gtk_widget_get_toplevel (app->mainwin);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
-
- gtk_widget_show (dialog);
-}
-
-void
-on_integrity_check_cb (GtkAction *action, BraseroApp *app)
-{
- GtkWidget *dialog;
- GtkWidget *toplevel;
-
- dialog = brasero_sum_dialog_new ();
- toplevel = gtk_widget_get_toplevel (app->mainwin);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
-
- gtk_widget_show (dialog);
-}
-
-void
-on_prefs_cb (GtkAction *action, BraseroApp *app)
-{
- GtkWidget *dialog;
- GtkWidget *toplevel;
-
- dialog = brasero_pref_new ();
- toplevel = gtk_widget_get_toplevel (app->mainwin);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
-
- gtk_widget_show_all (dialog);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-}
-
-void
-on_disc_info_cb (GtkAction *button, BraseroApp *app)
-{
-
-}
-
-void
-on_about_cb (GtkAction *action, BraseroApp *app)
-{
- const gchar *authors[] = {
- "Philippe Rouquier <bonfire-app wanadoo fr>",
- NULL
- };
-
- const gchar *documenters[] = {
- "Phil Bull <philbull gmail com>"
- "Milo Casagrande <milo_casagrande yahoo it>"
- "Andrew Stabeno <stabeno gmail com>",
- NULL
- };
-
- const gchar *license_part[] = {
- N_("Brasero 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."),
- N_("Brasero 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 General "
- "Public License for more details."),
- N_("You should have received a copy of the GNU General "
- "Public License along with Brasero; if not, write "
- "to the Free Software Foundation, Inc., "
- "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA"),
- NULL
- };
-
- gchar *license, *comments;
-
- comments = g_strdup (_("A simple to use CD/DVD burning application for GNOME"));
-
- license = g_strjoin ("\n\n",
- _(license_part[0]),
- _(license_part[1]),
- _(license_part[2]),
- NULL);
-
- gtk_show_about_dialog (GTK_WINDOW (app->mainwin),
- "program-name", "Brasero",
- "comments", comments,
- "version", VERSION,
- "copyright", "Copyright  2005-2008 Philippe Rouquier",
- "authors", authors,
- "documenters", documenters,
- "website", "http://www.gnome.org/projects/brasero",
- "website-label", _("Brasero Homepage"),
- "license", license,
- "wrap-license", TRUE,
- "logo-icon-name", "brasero",
- /* Translators: This is a special message that shouldn't be translated
- * literally. It is used in the about box to give credits to
- * the translators.
- * Thus, you should translate it to your name and email address.
- * You should also include other translators who have contributed to
- * this translation; in that case, please write each of them on a separate
- * line seperated by newlines (\n).
- */
- "translator-credits", _("translator-credits"),
- NULL);
-
- g_free (comments);
- g_free (license);
-}
-
-#ifdef BUILD_GNOME2
-
-void
-on_help_cb (GtkAction *action, BraseroApp *app)
-{
- GError *error = NULL;
-
- gnome_help_display ("brasero.xml",
- NULL,
- &error);
- if (error) {
- GtkWidget *d;
-
- d = gtk_message_dialog_new (GTK_WINDOW (app->mainwin),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- error->message);
- gtk_dialog_run (GTK_DIALOG(d));
- gtk_widget_destroy (d);
- g_error_free (error);
- error = NULL;
- }
-}
-
-#endif
-
-static gboolean
-on_window_state_changed_cb (GtkWidget *widget,
- GdkEventWindowState *event,
- BraseroApp *app)
-{
- if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
- app->is_maximised = 1;
- else
- app->is_maximised = 0;
-
- return FALSE;
-}
-
-static gboolean
-on_configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event,
- BraseroApp *app)
-{
- if (!app->is_maximised) {
- app->width = event->width;
- app->height = event->height;
- }
-
- return FALSE;
-}
-
-static void
-brasero_app_recent_open (GtkRecentChooser *chooser,
- BraseroApp *app)
-{
- gchar *uri;
- const gchar *mime;
- GtkRecentInfo *item;
- GtkRecentManager *manager;
-
- /* This is a workaround since following code doesn't work */
- /*
- item = gtk_recent_chooser_get_current_item (GTK_RECENT_CHOOSER (chooser));
- if (!item)
- return;
- */
-
- uri = gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (chooser));
- if (!uri)
- return;
-
- manager = gtk_recent_manager_get_default ();
- item = gtk_recent_manager_lookup_item (manager, uri, NULL);
- if (!item) {
- g_free (uri);
- return;
- }
-
- mime = gtk_recent_info_get_mime_type (item);
- if (!mime) {
- g_free (uri);
- g_warning ("Unrecognized mime type");
- return;
- }
-
- brasero_project_manager_open_by_mime (BRASERO_PROJECT_MANAGER (app->contents), uri, mime);
- gtk_recent_info_unref (item);
- g_free (uri);
-}
-
-static void
-brasero_app_add_recent (BraseroApp *app,
- GtkActionGroup *group)
-{
- GtkRecentManager *recent;
- GtkRecentFilter *filter;
- GtkAction *action;
-
- recent = gtk_recent_manager_get_default ();
- action = gtk_recent_action_new_for_manager ("RecentProjects",
- _("_Recent Projects"),
- _("Display the projects recently opened"),
- NULL,
- recent);
- filter = gtk_recent_filter_new ();
-
- gtk_recent_filter_set_name (filter, _("Brasero projects"));
- gtk_recent_filter_add_mime_type (filter, "application/x-brasero");
- gtk_recent_filter_add_mime_type (filter, "application/x-cd-image");
- gtk_recent_filter_add_mime_type (filter, "application/x-cdrdao-toc");
- gtk_recent_filter_add_mime_type (filter, "application/x-toc");
- gtk_recent_filter_add_mime_type (filter, "application/x-cue");
- gtk_recent_filter_add_mime_type (filter, "audio/x-scpls");
- gtk_recent_filter_add_mime_type (filter, "audio/x-ms-asx");
- gtk_recent_filter_add_mime_type (filter, "audio/x-mp3-playlist");
- gtk_recent_filter_add_mime_type (filter, "audio/x-mpegurl");
-
- gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (action), filter);
- gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (action), filter);
-
- gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (action), TRUE);
-
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), 5);
-
- gtk_recent_chooser_set_show_tips (GTK_RECENT_CHOOSER (action), TRUE);
-
- gtk_recent_chooser_set_show_icons (GTK_RECENT_CHOOSER (action), TRUE);
-
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (action), GTK_RECENT_SORT_MRU);
-
- gtk_action_group_add_action (group, action);
- g_object_unref (action);
- g_signal_connect (action,
- "item-activated",
- G_CALLBACK (brasero_app_recent_open),
- app);
-}
-
-static void
-brasero_menu_item_selected_cb (GtkMenuItem *proxy,
- BraseroApp *app)
-{
- GtkAction *action;
- gchar *message;
-
- action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
- g_return_if_fail (action != NULL);
-
- g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
- if (message) {
- gtk_statusbar_push (GTK_STATUSBAR (app->statusbar),
- app->tooltip_ctx,
- message);
- g_free (message);
- }
-}
-
-static void
-brasero_menu_item_deselected_cb (GtkMenuItem *proxy,
- BraseroApp *app)
-{
- gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar),
- app->tooltip_ctx);
-}
-
-static void
-brasero_connect_ui_manager_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- BraseroApp *app)
-{
- if (!GTK_IS_MENU_ITEM (proxy))
- return;
-
- g_signal_connect (proxy,
- "select",
- G_CALLBACK (brasero_menu_item_selected_cb),
- app);
- g_signal_connect (proxy,
- "deselect",
- G_CALLBACK (brasero_menu_item_deselected_cb),
- app);
-}
-
-static void
-brasero_disconnect_ui_manager_proxy_cb (GtkUIManager *manager,
- GtkAction *action,
- GtkWidget *proxy,
- BraseroApp *app)
-{
- if (!GTK_IS_MENU_ITEM (proxy))
- return;
-
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (brasero_menu_item_selected_cb),
- app);
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (brasero_menu_item_deselected_cb),
- app);
-}
-
-static void
-brasero_caps_changed_cb (BraseroPluginManager *manager,
- BraseroApp *app)
-{
- BraseroBurnCaps *caps;
- GtkWidget *widget;
-
- caps = brasero_burn_caps_get_default ();
- widget = gtk_ui_manager_get_widget (app->manager, "/menubar/ToolMenu/Check");
-
- if (!brasero_burn_caps_can_checksum (caps))
- gtk_widget_set_sensitive (widget, FALSE);
- else
- gtk_widget_set_sensitive (widget, TRUE);
-
- g_object_unref (caps);
-}
-
-static BraseroApp *
-brasero_app_create_app (void)
-{
- BraseroApp *app;
- GtkWidget *menubar;
- GtkWidget *contents;
- GError *error = NULL;
- BraseroBurnCaps *caps;
- GtkAccelGroup *accel_group;
- GtkActionGroup *action_group;
- BraseroPluginManager *plugin_manager;
-
- /* New window */
- app = g_new0 (BraseroApp, 1);
- app->mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- g_set_application_name (_("Brasero Disc Burning"));
-
- gtk_window_set_default_icon_name ("brasero");
- gtk_window_set_icon_name (GTK_WINDOW (app->mainwin), "brasero");
-
- g_signal_connect (G_OBJECT (app->mainwin), "delete-event",
- G_CALLBACK (on_delete_cb), app);
- g_signal_connect (G_OBJECT (app->mainwin), "destroy",
- G_CALLBACK (on_destroy_cb), app);
-
- /* contents */
- contents = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (contents);
-
- gtk_container_add (GTK_CONTAINER (app->mainwin), contents);
-
- /* menu and toolbar */
- app->manager = gtk_ui_manager_new ();
- g_signal_connect (app->manager,
- "connect-proxy",
- G_CALLBACK (brasero_connect_ui_manager_proxy_cb),
- app);
- g_signal_connect (app->manager,
- "disconnect-proxy",
- G_CALLBACK (brasero_disconnect_ui_manager_proxy_cb),
- app);
-
- action_group = gtk_action_group_new ("MenuActions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group,
- entries,
- G_N_ELEMENTS (entries),
- app);
-
- gtk_ui_manager_insert_action_group (app->manager, action_group, 0);
-
- brasero_app_add_recent (app, action_group);
-
- if (!gtk_ui_manager_add_ui_from_string (app->manager, description, -1, &error)) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
-
- menubar = gtk_ui_manager_get_widget (app->manager, "/menubar");
- gtk_box_pack_start (GTK_BOX (contents), menubar, FALSE, FALSE, 0);
-
- /* window contents */
- app->contents = brasero_project_manager_new ();
- gtk_widget_show (app->contents);
-
- gtk_box_pack_start (GTK_BOX (contents), app->contents, TRUE, TRUE, 0);
-
- /* status bar to display the size of selected files */
- app->statusbar = gtk_statusbar_new ();
- gtk_widget_show (app->statusbar);
- app->tooltip_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (app->statusbar), "tooltip_info");
- gtk_box_pack_end (GTK_BOX (contents), app->statusbar, FALSE, FALSE, 0);
-
- /* Update everything */
- brasero_project_manager_set_status (BRASERO_PROJECT_MANAGER (app->contents),
- app->statusbar);
- brasero_project_manager_register_ui (BRASERO_PROJECT_MANAGER (app->contents),
- app->manager);
-
- gtk_ui_manager_ensure_update (app->manager);
-
- /* check if we can use checksums (we need plugins enabled) */
- caps = brasero_burn_caps_get_default ();
- if (!brasero_burn_caps_can_checksum (caps)) {
- GtkWidget *widget;
-
- widget = gtk_ui_manager_get_widget (app->manager, "/menubar/ToolMenu/Check");
- gtk_widget_set_sensitive (widget, FALSE);
- }
- g_object_unref (caps);
-
- plugin_manager = brasero_plugin_manager_get_default ();
- g_signal_connect (plugin_manager,
- "caps-changed",
- G_CALLBACK (brasero_caps_changed_cb),
- app);
-
- /* add accelerators */
- accel_group = gtk_ui_manager_get_accel_group (app->manager);
- gtk_window_add_accel_group (GTK_WINDOW (app->mainwin), accel_group);
-
- /* set up the window geometry */
- gtk_window_set_position (GTK_WINDOW (app->mainwin), GTK_WIN_POS_CENTER);
-
-#ifdef BUILD_GNOME2
-
- brasero_session_connect (app);
-
-#endif
-
- g_signal_connect (app->mainwin,
- "window-state-event",
- G_CALLBACK (on_window_state_changed_cb),
- app);
- g_signal_connect (app->mainwin,
- "configure-event",
- G_CALLBACK (on_configure_event_cb),
- app);
- return app;
-}
-
static void
brasero_app_parse_options (BraseroApp *app)
{
gint nb = 0;
+ GtkWidget *manager;
gboolean load_default_project = FALSE;
+ manager = brasero_app_get_project_manager (app);
+
if (empty_project) {
- brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (app->contents));
+ brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
brasero_session_load (app, FALSE);
return;
}
@@ -710,7 +197,7 @@
gtk_dialog_run (GTK_DIALOG (message));
gtk_widget_destroy (message);
- brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (app->contents));
+ brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
}
else if (copy_project) {
gchar *device = NULL;
@@ -724,7 +211,7 @@
device = files [0];
/* this can't combine with any other options */
- brasero_project_manager_copy (BRASERO_PROJECT_MANAGER (app->contents), device);
+ brasero_project_manager_copy (BRASERO_PROJECT_MANAGER (manager), device);
}
else if (iso_uri) {
BRASERO_PROJECT_OPEN_URI (app, brasero_project_manager_iso, iso_uri);
@@ -768,21 +255,21 @@
list = g_slist_prepend (list, file);
}
- brasero_project_manager_data (BRASERO_PROJECT_MANAGER (app->contents), list);
+ brasero_project_manager_data (BRASERO_PROJECT_MANAGER (manager), list);
g_slist_free (list);
}
else if (files) {
BraseroProjectType type;
if (g_strv_length (files) > 1)
- BRASERO_PROJECT_OPEN_LIST (app, brasero_project_manager_data, files);
+ BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
- type = brasero_project_manager_open_uri (BRASERO_PROJECT_MANAGER (app->contents), files [0]);
+ type = brasero_project_manager_open_uri (BRASERO_PROJECT_MANAGER (manager), files [0]);
if (type == BRASERO_PROJECT_TYPE_INVALID)
- BRASERO_PROJECT_OPEN_LIST (app, brasero_project_manager_data, files);
+ BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
}
else {
- brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (app->contents));
+ brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));
load_default_project = TRUE;
}
@@ -797,7 +284,7 @@
GnomeProgram *program;
#endif
- BraseroApp *app;
+ GtkWidget *app;
GOptionContext *context;
context = g_option_context_new (_("[URI] [URI] ..."));
@@ -845,16 +332,16 @@
brasero_enable_multi_DND ();
brasero_utils_init ();
-
- app = brasero_app_create_app ();
+
+ app = brasero_app_new ();
if (app == NULL)
return 1;
- gtk_widget_realize (app->mainwin);
+ gtk_widget_realize (app);
brasero_app_parse_options (app);
- gtk_widget_show (app->mainwin);
+ gtk_widget_show (app);
gtk_main ();
@@ -862,12 +349,10 @@
#ifdef BUILD_GNOME2
- brasero_session_disconnect (app);
g_object_unref (program);
#endif
- g_free (app);
gst_deinit ();
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]