brasero r1027 - in trunk: . src



Author: philippr
Date: Sun Jul 20 13:21:38 2008
New Revision: 1027
URL: http://svn.gnome.org/viewvc/brasero?rev=1027&view=rev

Log:
	Make if possible to build brasero without libgnome/libgnomeui

	* Makefile.am:
	* configure.in:
	* src/brasero-menu.h:
	* src/brasero-project-size.c (brasero_project_size_size_request):
	* src/brasero-session.c:
	* src/main.c (brasero_app_create_app), (main):


Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/src/brasero-menu.h
   trunk/src/brasero-project-size.c
   trunk/src/brasero-session.c
   trunk/src/main.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Sun Jul 20 13:21:38 2008
@@ -1,5 +1,9 @@
 ## Process this file with automake to produce Makefile.in.
-SUBDIRS = src po data docs help
+SUBDIRS = src po data docs
+
+if BUILD_GNOME2
+SUBDIRS += help
+endif
 
 braserodocdir = ${prefix}/docs/brasero
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Jul 20 13:21:38 2008
@@ -91,14 +91,12 @@
 
 AC_SYS_LARGEFILE
 
-dnl ********** GNOME2 ******************************
+dnl ********** Required libraries **********************
 GLIB_REQUIRED=2.15.6
 GMODULE_REQUIRED=2.6.0
 GIO_REQUIRED=2.15.5
 GDK_REQUIRED=2.6.0
 GTK_REQUIRED=2.11.6
-LIBGNOME_REQUIRED=2.10.0
-LIBGNOMEUI_REQUIRED=2.10.0
 GCONF_REQUIRED=2.0.0
 GSTREAMER_REQUIRED=0.10.15
 GSTREAMER_BASE_REQUIRED=0.10.0
@@ -159,8 +157,6 @@
 	gmodule-2.0 >= $GMODULE_REQUIRED 	\
 	gdk-2.0 >= $GDK_REQUIRED	\
 	gtk+-2.0 >= $GTK_REQUIRED		\
-	libgnome-2.0 >= $LIBGNOME_REQUIRED	\
-	libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED	\
 	dbus-glib-1 >= $DBUS_REQUIRED)
 
 AC_SUBST(BRASERO_CFLAGS)
@@ -168,6 +164,29 @@
 BRASERO_CFLAGS="$BRASERO_BASE_CFLAGS $BRASERO_GSTREAMER_CFLAGS $BRASERO_GIO_CFLAGS $BRASERO_CFLAGS $CFLAGS"
 BRASERO_LIBS="$BRASERO_BASE_LIBS $BRASERO_GSTREAMER_LIBS $BRASERO_GIO_LIBS $BRASERO_LIBS $BRASERO_SCSI_LIBS $LDFLAGS"
 
+dnl ********** GNOME2 ******************************
+LIBGNOME_REQUIRED=2.10.0
+LIBGNOMEUI_REQUIRED=2.10.0
+
+AC_ARG_ENABLE(gnome2,
+			[  --enable-gnome2		Build with GNOME2 (improved integration with GNOME2, help system, session management support) [[default = yes]]],,
+			[enable_gnome2="yes"])
+
+if test x"$enable_gnome2" = "xyes"; then
+	PKG_CHECK_MODULES(GNOME2, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED, build_gnome2=yes, build_gnome2=no)
+else
+	build_gnome2="no"
+fi
+
+if test x"$build_gnome2" = "xyes"; then
+	BRASERO_CFLAGS="$BRASERO_CFLAGS $GNOME2_CFLAGS"
+	BRASERO_LIBS="$BRASERO_LIBS $GNOME2_LIBS"
+
+	AC_DEFINE(BUILD_GNOME2, 1, [define if you  want to build with tight GNOME2 integration])
+fi
+
+AM_CONDITIONAL(BUILD_GNOME2, test x"$build_gnome2" = "xyes")
+
 dnl ****************check for libburn (optional)**************
 LIBBURN_REQUIRED=0.4.0
 LIBISOFS_REQUIRED=0.6.4
@@ -375,6 +394,7 @@
 
 echo "Version: $BRASERO_VERSION
 	Update caches: ${enable_caches}
+	Build with GNOME2 : ${build_gnome2}
 	Build inotify: ${enable_inotify}
 	Build search pane : ${build_beagle}
 	Build playlist pane : ${build_totem}

Modified: trunk/src/brasero-menu.h
==============================================================================
--- trunk/src/brasero-menu.h	(original)
+++ trunk/src/brasero-menu.h	Sun Jul 20 13:21:38 2008
@@ -53,13 +53,17 @@
 void on_burn_cb (GtkAction *action, BraseroApp *app);
 void on_disc_info_cb (GtkAction *action, BraseroApp *app);
 void on_about_cb (GtkAction *action, BraseroApp *app);
-void on_help_cb (GtkAction *action, BraseroApp *app);
+
+#ifdef BUILD_GNOME2
+	void on_help_cb (GtkAction *action, BraseroApp *app);
+#endif
 
 static GtkActionEntry entries[] = {
 	{"ProjectMenu", NULL, N_("_Project")},
 	{"ViewMenu", NULL, N_("_View")},
 	{"EditMenu", NULL, N_("_Edit")},
 	{"ToolMenu", NULL, N_("_Tools")},
+
 	{"HelpMenu", NULL, N_("_Help")},
 
 	{"Plugins", NULL, N_("P_lugins"), NULL,
@@ -76,10 +80,14 @@
 
 	{"Exit", GTK_STOCK_QUIT, NULL, NULL,
 	 N_("Exit the program"), G_CALLBACK (on_exit_cb)},
+
+#ifdef BUILD_GNOME2
 	
 	{"Contents", GTK_STOCK_HELP, N_("_Contents"), "F1", N_("Contents"),
 	 G_CALLBACK (on_help_cb)}, 
 
+#endif
+
 	{"About", GTK_STOCK_ABOUT, NULL, NULL, N_("About"),
 	 G_CALLBACK (on_about_cb)},
 
@@ -112,8 +120,11 @@
 		"<menuitem action='Check'/>"
 	    "</menu>"
 	    "<menu action='HelpMenu'>"
+
+#ifdef BUILD_GNOME2
 		"<menuitem action='Contents'/>"
 		"<separator/>"
+#endif
 		"<menuitem action='About'/>"
 	    "</menu>"
 	    "</menubar>"

Modified: trunk/src/brasero-project-size.c
==============================================================================
--- trunk/src/brasero-project-size.c	(original)
+++ trunk/src/brasero-project-size.c	Sun Jul 20 13:21:38 2008
@@ -617,11 +617,12 @@
 
 	self = BRASERO_PROJECT_SIZE (widget);
 
-
 	/* Set markup every time a size change this function is called */
 	text = brasero_project_size_get_media_string (self);
-	pango_layout_set_markup (self->priv->text_layout, text, -1);
-	g_free (text);
+	if (text) {
+		pango_layout_set_markup (self->priv->text_layout, text, -1);
+		g_free (text);
+	}
 
 	brasero_project_size_get_ruler_min_width (self, &ruler_width, &ruler_height);
 	gtk_widget_size_request (self->priv->button, &req);

Modified: trunk/src/brasero-session.c
==============================================================================
--- trunk/src/brasero-session.c	(original)
+++ trunk/src/brasero-session.c	Sun Jul 20 13:21:38 2008
@@ -24,12 +24,16 @@
  *  <brasero-app wanadoo fr>
  ****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <string.h>
 
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include <libgnomeui/gnome-client.h>
+#include <gtk/gtk.h>
 
 #include <libxml/xmlerror.h>
 #include <libxml/xmlwriter.h>
@@ -40,8 +44,6 @@
 #include "brasero-session.h"
 #include "brasero-project-manager.h"
 
-static GnomeClient *client = NULL;
-
 #define SESSION_VERSION "0.1"
 
 static gchar *
@@ -300,6 +302,16 @@
 	return FALSE;
 }
 
+#ifdef BUILD_GNOME2
+
+/**
+ * This code is for session management
+ */
+
+#include <libgnomeui/gnome-client.h>
+
+static GnomeClient *client = NULL;
+
 static void
 brasero_session_die_cb (GnomeClient *client_loc,
 			BraseroApp *app)
@@ -366,3 +378,5 @@
 
 	client = NULL;
 }
+
+#endif

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sun Jul 20 13:21:38 2008
@@ -23,12 +23,11 @@
  *  <brasero-app wanadoo fr>
  ****************************************************************************/
 
-#include <string.h>
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
+#include <string.h>
 #include <locale.h>
 
 #include <glib.h>
@@ -41,9 +40,13 @@
 #include <gst/gst.h>
 #include <gst/pbutils/pbutils.h>
 
+#ifdef BUILD_GNOME2
+
 #include <libgnome/gnome-help.h>
 #include <libgnomeui/libgnomeui.h>
 
+#endif
+
 #include <gconf/gconf-client.h>
 
 #include "brasero-app.h"
@@ -319,11 +322,13 @@
 	g_free (license);
 }
 
+#ifdef BUILD_GNOME2
+
 void
 on_help_cb (GtkAction *action, BraseroApp *app)
 {
-    	GError *error = NULL;
-    
+	GError *error = NULL;
+
  	gnome_help_display ("brasero.xml",
 			     NULL,
 			     &error);
@@ -341,6 +346,8 @@
 	}
 }
 
+#endif
+
 static gboolean
 on_window_state_changed_cb (GtkWidget *widget,
 			    GdkEventWindowState *event,
@@ -539,6 +546,7 @@
 {
 	BraseroApp *app;
 	GtkWidget *menubar;
+	GtkWidget *contents;
 	GError *error = NULL;
 	BraseroBurnCaps *caps;
 	GtkAccelGroup *accel_group;
@@ -547,7 +555,9 @@
 
 	/* New window */
 	app = g_new0 (BraseroApp, 1);
-	app->mainwin = gnome_app_new ("Brasero", NULL);
+	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");
@@ -557,18 +567,11 @@
 	g_signal_connect (G_OBJECT (app->mainwin), "destroy",
 			  G_CALLBACK (on_destroy_cb), app);
 
-	/* status bar to display the size of selected files */
-	app->statusbar = gtk_statusbar_new ();
-	app->tooltip_ctx = gtk_statusbar_get_context_id (GTK_STATUSBAR (app->statusbar), "tooltip_info");
-	gnome_app_set_statusbar (GNOME_APP (app->mainwin), app->statusbar);
-
-	/* window contents */
-	app->contents = brasero_project_manager_new ();
-	gtk_widget_show (app->contents);
+	/* contents */
+	contents = gtk_vbox_new (FALSE, 0);
+	gtk_widget_show (contents);
 
-	gnome_app_set_contents (GNOME_APP (app->mainwin), app->contents);
-    	brasero_project_manager_set_status (BRASERO_PROJECT_MANAGER (app->contents),
-					    app->statusbar);
+	gtk_container_add (GTK_CONTAINER (app->mainwin), contents);
 
 	/* menu and toolbar */
 	app->manager = gtk_ui_manager_new ();
@@ -597,12 +600,28 @@
 		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);
-	menubar = gtk_ui_manager_get_widget (app->manager, "/menubar");
-	gnome_app_set_menus (GNOME_APP (app->mainwin), GTK_MENU_BAR (menubar));
 
 	/* check if we can use checksums (we need plugins enabled) */
 	caps = brasero_burn_caps_get_default ();
@@ -627,8 +646,12 @@
 	/* 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),
@@ -760,8 +783,12 @@
 int
 main (int argc, char **argv)
 {
-	BraseroApp *app;
+
+#ifdef BUILD_GNOME2
 	GnomeProgram *program;
+#endif
+
+	BraseroApp *app;
 	GOptionContext *context;
 
 	context = g_option_context_new (_("[URI] [URI] ..."));
@@ -769,13 +796,6 @@
 					   options,
 					   GETTEXT_PACKAGE);
 
-	program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
-				      argc, argv,
-				      GNOME_PARAM_GOPTION_CONTEXT, context,
-				      GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
-				      GNOME_PARAM_HUMAN_READABLE_NAME, _("CD/DVD burning"),
-				      NULL);
-
 #ifdef ENABLE_NLS
 	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -785,6 +805,27 @@
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
 
+	g_type_init ();
+
+#ifdef BUILD_GNOME2
+
+	program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
+				      argc, argv,
+				      GNOME_PARAM_GOPTION_CONTEXT, context,
+				      GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
+				      GNOME_PARAM_HUMAN_READABLE_NAME, _("CD/DVD burning"),
+				      NULL);
+
+#else
+
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, NULL) == FALSE) {
+		g_print (_("Please type %s --help to see all available options\n"), argv [0]);
+		exit (1);
+	}
+
+#endif
+
 	gst_init (&argc, &argv);
 
 	/* This is for missing codec automatic install */
@@ -811,8 +852,14 @@
 	gtk_main ();
 
 	brasero_burn_library_shutdown ();
+
+#ifdef BUILD_GNOME2
+
 	brasero_session_disconnect (app);
 	g_object_unref (program);
+
+#endif
+
 	g_free (app);
 	gst_deinit ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]