[gedit] Basic mac OS X integration (menu, dock, bundle)



commit 5e764a41f4ddc174e29b0c7d1dfc8875b3cdedfa
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Thu Jun 11 13:52:12 2009 +0200

    Basic mac OS X integration (menu, dock, bundle)

 configure.ac                 |   15 ++
 data/gedit.schemas.in.in     |    4 +-
 gedit/Makefile.am            |   17 ++-
 gedit/gedit-app.c            |   83 ++++++++-
 gedit/gedit-commands-file.c  |   58 ++++++-
 gedit/gedit-dirs.c           |   95 ++++++++--
 gedit/gedit-help.c           |   15 ++
 gedit/gedit-prefs-manager.h  |   11 +
 gedit/gedit-ui.h             |   13 ++-
 gedit/gedit-window-private.h |    1 +
 gedit/gedit-window.c         |   98 ++++++----
 gedit/gedit-window.h         |    2 +
 gedit/gedit.c                |    7 +
 gedit/osx/Makefile.am        |   20 ++
 gedit/osx/gedit-osx.c        |   75 ++++++++
 gedit/osx/gedit-osx.h        |   14 ++
 osx/Info.plist               |   30 +++
 osx/dmg-data/background.png  |  Bin 0 -> 31115 bytes
 osx/dmg-data/background.svg  |  395 ++++++++++++++++++++++++++++++++++++++
 osx/gedit.bundle             |  110 +++++++++++
 osx/gedit.icns               |  Bin 0 -> 175597 bytes
 osx/gtkrc                    |  428 ++++++++++++++++++++++++++++++++++++++++++
 osx/launcher.sh              |   59 ++++++
 osx/makebundle.sh            |   12 ++
 osx/makedmg.sh               |   64 +++++++
 osx/template.dmg             |  Bin 0 -> 19345408 bytes
 26 files changed, 1559 insertions(+), 67 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3e8053f..a0c7468 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,8 +102,22 @@ AM_CONDITIONAL(PLATFORM_OSX, test "$platform_osx" = "yes")
 
 if test "$platform_osx" = "yes"; then
 	AC_DEFINE([PLATFORM_OSX],[1],[Defined if platform is Mac OSX])
+
+	PKG_CHECK_MODULES(OSX, ige-mac-integration)
+
+	AC_SUBST(OSX_CFLAGS)
+	AC_SUBST(OSX_LIBS)
+
+	DEFAULT_FONT="Monaco 12"
+	DEFAULT_PRINT_FONT="Monaco 10"
+else
+	DEFAULT_FONT="Monospace 12"
+	DEFAULT_PRINT_FONT="Monospace 9"
 fi
 
+AC_SUBST(DEFAULT_FONT)
+AC_SUBST(DEFAULT_PRINT_FONT)
+
 dnl ===============================================================
 dnl Expanded dirs
 dnl ===============================================================
@@ -463,6 +477,7 @@ docs/Makefile
 docs/reference/Makefile
 gedit/dialogs/Makefile
 gedit/smclient/Makefile
+gedit/osx/Makefile
 gedit/Makefile
 help/Makefile
 pixmaps/Makefile
diff --git a/data/gedit.schemas.in.in b/data/gedit.schemas.in.in
index b8cd4fa..a16f3fa 100644
--- a/data/gedit.schemas.in.in
+++ b/data/gedit.schemas.in.in
@@ -22,7 +22,7 @@
       <type>string</type>
       <locale name="C">
         <default><!-- Translators: This is the Editor Font.
-	This is a Pango font-->Monospace 12</default>
+	This is a Pango font-->@DEFAULT_FONT@</default>
 	<short>Editor Font</short>
 	<long>A custom font that will be used for the editing area.
 	This will only take effect if the "Use Default Font" option is
@@ -394,7 +394,7 @@
       <type>string</type>
       <locale name="C">
         <default><!-- Translators: This is the Body font for printing. 
-        This is a Pango font.-->Monospace 9</default>
+        This is a Pango font.-->@DEFAULT_PRINT_FONT@</default>
 	<short>Body Font for Printing</short>
 	<long>Specifies the font to use for a document's body when
 	printing documents.</long>
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 40f64f1..b2fefaa 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -1,6 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 SUBDIRS = dialogs smclient
 
+if PLATFORM_OSX
+SUBDIRS += osx
+endif
+
 bin_PROGRAMS = gedit
 
 noinst_LTLIBRARIES = libgedit.la
@@ -10,6 +14,7 @@ INCLUDES =								\
 	-I$(srcdir)							\
 	-I$(srcdir)/smclient						\
 	$(GEDIT_CFLAGS)							\
+	$(OSX_CFLAGS)							\
 	$(WARN_CFLAGS)							\
 	$(DISABLE_DEPRECATED_CFLAGS)					\
 	-DDATADIR=\""$(datadir)"\"					\
@@ -18,7 +23,7 @@ INCLUDES =								\
 gedit_SOURCES = \
 	gedit.c
 
-gedit_LDADD = libgedit.la $(GEDIT_LIBS) $(EGG_SMCLIENT_LIBS)
+gedit_LDADD = libgedit.la $(GEDIT_LIBS) $(OSX_LIBS) $(EGG_SMCLIENT_LIBS)
  
 if PLATFORM_WIN32
 gedit_LDFLAGS = -Wl,--export-all-symbols -mwindows -Wl,--out-implib,libgedit-$(GEDIT_API_VERSION).a
@@ -26,10 +31,6 @@ else
 gedit_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
 endif
 
-if PLATFORM_OSX
-gedit_LDFLAGS += -framework Carbon
-endif
-
 libgedit_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
 
 libgedit_la_LIBADD = \
@@ -39,6 +40,12 @@ libgedit_la_LIBADD = \
 # GEDIT_LIBS must be the last to ensure correct order on some platforms
 libgedit_la_LIBADD += $(GEDIT_LIBS)
 
+if PLATFORM_OSX
+gedit_LDFLAGS += -framework Carbon
+
+libgedit_la_LIBADD += osx/libosx.la
+endif
+
 BUILT_SOURCES = 			\
 	gedit-enum-types.c		\
 	gedit-enum-types.h		\
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index db52a18..557bcad 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -46,6 +46,9 @@
 #include "gedit-enum-types.h"
 #include "gedit-dirs.h"
 
+#ifdef PLATFORM_OSX
+#include <ige-mac-integration.h>
+#endif
 
 #define GEDIT_PAGE_SETUP_FILE		"gedit-page-setup"
 #define GEDIT_PRINT_SETTINGS_FILE	"gedit-print-settings"
@@ -372,6 +375,60 @@ gedit_app_get_default (void)
 	return app;
 }
 
+#ifdef PLATFORM_OSX
+static GtkMenuItem *
+ui_manager_menu_item (GtkUIManager *uimanager,
+                      const gchar  *path)
+{
+	return GTK_MENU_ITEM (gtk_ui_manager_get_widget (uimanager, path));
+}
+
+static void
+osx_switch_menubar (GeditApp    *app,
+                    GeditWindow *window)
+{
+	GtkWidget *menubar;
+
+	if (window != NULL && app->priv->active_window != window)
+	{
+		GtkUIManager *uimanager;
+		IgeMacMenuGroup *group;
+		GtkAction *action;
+
+		menubar = _gedit_window_get_menu_bar (window);
+		uimanager = gedit_window_get_ui_manager (window);
+
+		gtk_widget_hide (menubar);
+		action = gtk_ui_manager_get_action (uimanager, "/ui/MenuBar/HelpMenu/HelpAboutMenu");
+
+		gtk_action_set_label (action, _("About gedit"));
+
+		ige_mac_menu_set_menu_bar (GTK_MENU_SHELL (menubar));
+
+		ige_mac_menu_set_quit_menu_item (ui_manager_menu_item (uimanager, "/ui/MenuBar/FileMenu/FileQuitMenu"));
+
+		group = ige_mac_menu_add_app_menu_group ();
+
+		ige_mac_menu_add_app_menu_item (group,
+		                                ui_manager_menu_item (uimanager, "/ui/MenuBar/HelpMenu/HelpAboutMenu"),
+		                                NULL);
+
+		ige_mac_menu_set_preferences_menu_item (ui_manager_menu_item (uimanager, "/ui/MenuBar/EditMenu/EditPreferencesMenu"));
+	}
+}
+#endif
+
+static void
+set_active_window (GeditApp    *app,
+                   GeditWindow *window)
+{
+#ifdef PLATFORM_OSX
+	osx_switch_menubar (app, window);
+#endif
+
+	app->priv->active_window = window;
+}
+
 static gboolean
 window_focus_in_event (GeditWindow   *window, 
 		       GdkEventFocus *event, 
@@ -380,7 +437,7 @@ window_focus_in_event (GeditWindow   *window,
 	/* updates active_view and active_child when a new toplevel receives focus */
 	g_return_val_if_fail (GEDIT_IS_WINDOW (window), FALSE);
 
-	app->priv->active_window = window;
+	set_active_window (app, window);
 
 	return FALSE;
 }
@@ -415,8 +472,7 @@ window_destroy (GeditWindow *window,
 
 	if (window == app->priv->active_window)
 	{
-		app->priv->active_window = app->priv->windows != NULL ?
-					   app->priv->windows->data : NULL;
+		set_active_window (app, app->priv->windows != NULL ? app->priv->windows->data : NULL);
 	}
 
 /* CHECK: I don't think we have to disconnect this function, since windows
@@ -428,11 +484,20 @@ window_destroy (GeditWindow *window,
 	g_signal_handlers_disconnect_by_func (window, 
 					      G_CALLBACK (window_destroy),
 					      app);
-*/					      
+*/
 	if (app->priv->windows == NULL)
 	{
-		/* Last window is gone... save some settings and exit */
+#ifdef PLATFORM_OSX
+		if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "gedit-is-quitting-all")))
+		{
+			GeditWindow *hidden;
 
+			/* create new hidden window */
+			hidden = gedit_app_create_window (app, NULL);
+			return;
+		}
+#endif
+		/* Last window is gone... save some settings and exit */
 		ensure_user_config_dir ();
 
 		save_accels ();
@@ -476,8 +541,8 @@ gedit_app_create_window_real (GeditApp    *app,
 	 */
 	if (app->priv->windows == NULL)
 	{
-		app->priv->active_window = window = g_object_new (GEDIT_TYPE_WINDOW,
-								  NULL);
+		window = g_object_new (GEDIT_TYPE_WINDOW, NULL);
+		set_active_window (app, window);
 	}
 	else
 	{
@@ -541,6 +606,10 @@ gedit_app_create_window_real (GeditApp    *app,
 			  G_CALLBACK (window_destroy),
 			  app);
 
+#ifdef PLATFORM_OSX
+	gtk_widget_hide (_gedit_window_get_menu_bar (window));
+#endif
+
 	return window;
 }
 
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 23767fc..d7f7b46 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -57,7 +57,7 @@
 #define GEDIT_IS_CLOSING_ALL            "gedit-is-closing-all"
 #define GEDIT_IS_QUITTING 	        "gedit-is-quitting"
 #define GEDIT_IS_CLOSING_TAB		"gedit-is-closing-tab"
-
+#define GEDIT_IS_QUITTING_ALL		"gedit-is-quitting-all"
 
 static void tab_state_changed_while_saving (GeditTab    *tab,
 					    GParamSpec  *pspec,
@@ -1643,6 +1643,12 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
 			g_object_set_data (G_OBJECT (window),
 					   GEDIT_IS_QUITTING,
 					   GBOOLEAN_TO_POINTER (FALSE));
+
+#ifdef PLATFORM_OSX
+			g_object_set_data (G_OBJECT (window),
+			                   GEDIT_IS_QUITTING_ALL,
+			                   GINT_TO_POINTER (FALSE));
+#endif
 			break;
 	}
 
@@ -1704,6 +1710,11 @@ _gedit_cmd_file_close_tab (GeditTab    *tab,
 			   GEDIT_IS_QUITTING,
 			   GBOOLEAN_TO_POINTER (FALSE));
 
+	g_object_set_data (G_OBJECT (window), 
+	                   GEDIT_IS_QUITTING_ALL, 
+	                   GINT_TO_POINTER (FALSE));
+
+
 	if (tab_can_close (tab, GTK_WINDOW (window)))
 		gedit_window_close_tab (window, tab);
 }
@@ -1717,8 +1728,15 @@ _gedit_cmd_file_close (GtkAction   *action,
 	gedit_debug (DEBUG_COMMANDS);
 
 	active_tab = gedit_window_get_active_tab (window);
+
 	if (active_tab == NULL)
+	{
+#ifdef PLATFORM_OSX
+		/* Close the window on OS X */
+		gtk_widget_destroy (GTK_WIDGET (window));
+#endif
 		return;
+	}
 
 	_gedit_cmd_file_close_tab (active_tab, window);
 }
@@ -1809,12 +1827,50 @@ _gedit_cmd_file_close_all (GtkAction   *action,
 }
 
 /* Quit */
+#ifdef PLATFORM_OSX
+static void
+quit_all ()
+{
+	GList *windows;
+	GList *item;
+	GeditApp *app;
+
+	app = gedit_app_get_default ();
+	windows = g_list_copy ((GList *)gedit_app_get_windows (app));
+
+	for (item = windows; item; item = g_list_next (item))
+	{
+		GeditWindow *window = GEDIT_WINDOW (item->data);
+	
+		g_object_set_data (G_OBJECT (window),
+		                   GEDIT_IS_QUITTING_ALL,
+		                   GINT_TO_POINTER (TRUE));
+
+		if (!(gedit_window_get_state (window) &
+		                    (GEDIT_WINDOW_STATE_SAVING |
+		                     GEDIT_WINDOW_STATE_PRINTING |
+		                     GEDIT_WINDOW_STATE_SAVING_SESSION)))
+		{
+			file_close_all (window, TRUE);
+		}
+	}
+}
+#endif
+
 void
 _gedit_cmd_file_quit (GtkAction   *action,
 		     GeditWindow *window)
 {
 	gedit_debug (DEBUG_COMMANDS);
 
+#ifdef PLATFORM_OSX
+	if (action != NULL)
+	{
+		quit_all ();
+		return;
+	}
+#endif
+
 	g_return_if_fail (!(gedit_window_get_state (window) &
 	                    (GEDIT_WINDOW_STATE_SAVING |
 	                     GEDIT_WINDOW_STATE_PRINTING |
diff --git a/gedit/gedit-dirs.c b/gedit/gedit-dirs.c
index da9fec5..3ef491b 100644
--- a/gedit/gedit-dirs.c
+++ b/gedit/gedit-dirs.c
@@ -20,8 +20,16 @@
  * Boston, MA 02111-1307, USA. 
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "gedit-dirs.h"
 
+#ifdef PLATFORM_OSX
+#include <ige-mac-bundle.h>
+#endif
+
 gchar *
 gedit_dirs_get_user_config_dir (void)
 {
@@ -119,11 +127,7 @@ gedit_dirs_get_gedit_data_dir (void)
 {
 	gchar *data_dir;
 
-#ifndef G_OS_WIN32
-	data_dir = g_build_filename (DATADIR,
-				     "gedit-2",
-				     NULL);
-#else
+#ifdef G_OS_WIN32
 	gchar *win32_dir;
 	
 	win32_dir = g_win32_get_package_installation_directory_of_module (NULL);
@@ -134,6 +138,27 @@ gedit_dirs_get_gedit_data_dir (void)
 				     NULL);
 	
 	g_free (win32_dir);
+#else
+#ifdef PLATFORM_OSX
+	IgeMacBundle *bundle = ige_mac_bundle_get_default ();
+
+	if (ige_mac_bundle_get_is_app_bundle (bundle))
+	{
+		const gchar *bundle_data_dir = ige_mac_bundle_get_datadir (bundle);
+
+		data_dir = g_build_filename (bundle_data_dir,
+		                             "gedit-2",
+	                                     NULL);
+	}
+	else
+	{
+		data_dir = g_build_filename (DATADIR, "gedit-2", NULL);
+	}
+#else
+	data_dir = g_build_filename (DATADIR,
+	                             "gedit-2",
+	                             NULL);
+#endif
 #endif
 
 	return data_dir;
@@ -144,11 +169,7 @@ gedit_dirs_get_gedit_locale_dir (void)
 {
 	gchar *locale_dir;
 
-#ifndef G_OS_WIN32
-	locale_dir = g_build_filename (DATADIR,
-				       "locale",
-				       NULL);
-#else
+#ifdef G_OS_WIN32
 	gchar *win32_dir;
 	
 	win32_dir = g_win32_get_package_installation_directory_of_module (NULL);
@@ -159,6 +180,31 @@ gedit_dirs_get_gedit_locale_dir (void)
 				       NULL);
 	
 	g_free (win32_dir);
+#else
+#ifdef PLATFORM_OSX
+	IgeMacBundle *bundle = ige_mac_bundle_get_default ();
+
+	if (ige_mac_bundle_get_is_app_bundle (bundle))
+	{
+		locale_dir = g_strdup (ige_mac_bundle_get_localedir (bundle));
+	}
+	else
+	{
+		gchar *data_dir = gedit_dirs_get_gedit_data_dir ();
+		locale_dir = g_build_filename (data_dir,
+		                               "locale",
+		                               NULL);
+		g_free (data_dir);
+	}
+#else
+	gchar *data_dir;
+
+	data_dir = gedit_dirs_get_data_dir ();
+	locale_dir = g_build_filename (data_dir,
+				       "locale",
+				       NULL);
+	g_free (data_dir);
+#endif
 #endif
 
 	return locale_dir;
@@ -169,11 +215,7 @@ gedit_dirs_get_gedit_lib_dir (void)
 {
 	gchar *lib_dir;
 
-#ifndef G_OS_WIN32
-	lib_dir = g_build_filename (LIBDIR,
-				    "gedit-2",
-				    NULL);
-#else
+#ifdef G_OS_WIN32
 	gchar *win32_dir;
 	
 	win32_dir = g_win32_get_package_installation_directory_of_module (NULL);
@@ -184,6 +226,29 @@ gedit_dirs_get_gedit_lib_dir (void)
 				    NULL);
 	
 	g_free (win32_dir);
+#else
+#ifdef PLATFORM_OSX
+	IgeMacBundle *bundle = ige_mac_bundle_get_default ();
+
+	if (ige_mac_bundle_get_is_app_bundle (bundle))
+	{
+ 		const gchar *path = ige_mac_bundle_get_resourcesdir (bundle);
+		lib_dir = g_build_filename (path,
+	                            	"lib",
+	                            	"gedit-2",
+	                            	NULL);
+	}
+	else
+	{
+		lib_dir = g_build_filename (LIBDIR,
+					    "gedit-2",
+					    NULL);
+	}
+#else
+	lib_dir = g_build_filename (LIBDIR,
+				    "gedit-2",
+				    NULL);
+#endif
 #endif
 
 	return lib_dir;
diff --git a/gedit/gedit-help.c b/gedit/gedit-help.c
index 5df9dc6..750e9af 100644
--- a/gedit/gedit-help.c
+++ b/gedit/gedit-help.c
@@ -38,6 +38,10 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
+#ifdef PLATFORM_OSX
+#include "osx/gedit-osx.h"
+#endif
+
 gboolean    
 gedit_help_display (GtkWindow   *parent,
 		    const gchar *name, /* "gedit" if NULL */
@@ -49,6 +53,17 @@ gedit_help_display (GtkWindow   *parent,
 	
 	g_return_val_if_fail ((parent == NULL) || GTK_IS_WINDOW (parent), FALSE);
 
+#ifdef PLATFORM_OSX
+	if (name == NULL || strcmp(name, "gedit.xml") == NULL || strcmp(name, "gedit") == 0)
+	{
+		return gedit_osx_show_help (link_id);
+	}
+	else
+	{
+		return FALSE;
+	}
+#endif
+
 	if (name == NULL)
 		name = "gedit";
 	else if (strcmp (name, "gedit.xml") == 0)
diff --git a/gedit/gedit-prefs-manager.h b/gedit/gedit-prefs-manager.h
index b9b14b3..c001f12 100644
--- a/gedit/gedit-prefs-manager.h
+++ b/gedit/gedit-prefs-manager.h
@@ -145,8 +145,14 @@
 /* Fallback default values. Keep in sync with gedit.schemas */
 
 #define GPM_DEFAULT_USE_DEFAULT_FONT 	1 /* TRUE */
+
+#ifndef PLATFORM_OSX
 #define GPM_DEFAULT_EDITOR_FONT 	(const gchar*) "Monospace 12"
 #define GPM_DEFAULT_SYSTEM_FONT 	(const gchar*) "Monospace 10"
+#else
+#define GPM_DEFAULT_EDITOR_FONT		(const gchar*) "Monaco 12"
+#define GPM_DEFAULT_SYSTEM_FONT		(const gchar*) "Monaco 12"
+#endif
 
 #define GPM_DEFAULT_CREATE_BACKUP_COPY	1 /* TRUE */
 #define GPM_DEFAULT_BACKUP_COPY_EXTENSION (const gchar*) "~"
@@ -180,7 +186,12 @@
 #define GPM_DEFAULT_PRINT_WRAP_MODE	"GTK_WRAP_WORD"
 #define GPM_DEFAULT_PRINT_LINE_NUMBERS	0 /* No numbers */
 
+#ifndef PLATFORM_OSX
 #define GPM_DEFAULT_PRINT_FONT_BODY 	(const gchar*) "Monospace 9"
+#else
+#define GPM_DEFAULT_PRINT_FONT_BODY	(const gchar*) "Monaco 10"
+#endif
+
 #define GPM_DEFAULT_PRINT_FONT_HEADER	(const gchar*) "Sans 11"
 #define GPM_DEFAULT_PRINT_FONT_NUMBERS	(const gchar*) "Sans 8"
 
diff --git a/gedit/gedit-ui.h b/gedit/gedit-ui.h
index 121688e..b1e5bf7 100644
--- a/gedit/gedit-ui.h
+++ b/gedit/gedit-ui.h
@@ -57,6 +57,11 @@ static const GtkActionEntry gedit_always_sensitive_menu_entries[] =
 	  N_("Create a new document"), G_CALLBACK (_gedit_cmd_file_new) },
 	{ "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
 	  N_("Open a file"), G_CALLBACK (_gedit_cmd_file_open) },
+
+#ifdef PLATFORM_OSX
+	{ "FileClose", GTK_STOCK_CLOSE, NULL, "<control>W",
+	  N_("Close the current file"), G_CALLBACK (_gedit_cmd_file_close) },
+#endif
 	
 	/* Edit menu */
 	{ "EditPreferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL,
@@ -91,9 +96,10 @@ static const GtkActionEntry gedit_menu_entries[] =
 	  N_("Print preview"), G_CALLBACK (_gedit_cmd_file_print_preview) },
 	 { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
 	  N_("Print the current page"), G_CALLBACK (_gedit_cmd_file_print) },
+#ifndef PLATFORM_OSX
 	{ "FileClose", GTK_STOCK_CLOSE, NULL, "<control>W",
 	  N_("Close the current file"), G_CALLBACK (_gedit_cmd_file_close) },
-
+#endif
 	/* Edit menu */
 	{ "EditUndo", GTK_STOCK_UNDO, NULL, "<control>Z",
 	  N_("Undo the last action"), G_CALLBACK (_gedit_cmd_edit_undo) },
@@ -120,8 +126,13 @@ static const GtkActionEntry gedit_menu_entries[] =
 	  N_("Search forwards for the same text"), G_CALLBACK (_gedit_cmd_search_find_next) },
 	{ "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
 	  N_("Search backwards for the same text"), G_CALLBACK (_gedit_cmd_search_find_prev) },
+#ifndef PLATFORM_OSX
 	{ "SearchReplace", GTK_STOCK_FIND_AND_REPLACE, N_("_Replace..."), "<control>H",
 	  N_("Search for and replace text"), G_CALLBACK (_gedit_cmd_search_replace) },
+#else
+	{ "SearchReplace", GTK_STOCK_FIND_AND_REPLACE, N_("_Replace..."), "<control><alt>F",
+	  N_("Search for and replace text"), G_CALLBACK (_gedit_cmd_search_replace) },
+#endif
 	{ "SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>K",
 	  N_("Clear highlighting of search matches"), G_CALLBACK (_gedit_cmd_search_clear_highlight) },
 	{ "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "<control>I",
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 0467d8e..a364874 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -78,6 +78,7 @@ struct _GeditWindowPrivate
 	guint           documents_list_menu_ui_id;
 	GtkWidget      *toolbar;
 	GtkWidget      *toolbar_recent_menu;
+	GtkWidget      *menubar;
 	GeditToolbarSetting toolbar_style;
 
 	/* recent files */
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 680393c..64c61a8 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -57,6 +57,10 @@
 #include "gedit-dirs.h"
 #include "gedit-status-combo-box.h"
 
+#ifdef PLATFORM_OSX
+#include "osx/gedit-osx.h"
+#endif
+
 #define LANGUAGE_NONE (const gchar *)"LangNone"
 #define GEDIT_UIFILE "gedit-ui.xml"
 #define TAB_WIDTH_DATA "GeditWindowTabWidthData"
@@ -718,7 +722,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
 				  (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
 				  !(lockdown & GEDIT_LOCKDOWN_PRINTING));
 				  
-	action = gtk_action_group_get_action (window->priv->action_group,
+	action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
 					      "FileClose");
 
 	gtk_action_set_sensitive (action,
@@ -1408,7 +1412,6 @@ create_menu_bar_and_toolbar (GeditWindow *window,
 	GtkActionGroup *action_group;
 	GtkAction *action;
 	GtkUIManager *manager;
-	GtkWidget *menubar;
 	GtkRecentManager *recent_manager;
 	GError *error = NULL;
 	gchar *ui_file;
@@ -1557,9 +1560,9 @@ create_menu_bar_and_toolbar (GeditWindow *window,
 	gtk_ui_manager_insert_action_group (manager, action_group, 0);
 	g_object_unref (action_group);
 
-	menubar = gtk_ui_manager_get_widget (manager, "/MenuBar");
+	window->priv->menubar = gtk_ui_manager_get_widget (manager, "/MenuBar");
 	gtk_box_pack_start (GTK_BOX (main_box), 
-			    menubar, 
+			    window->priv->menubar,
 			    FALSE, 
 			    FALSE, 
 			    0);
@@ -2126,7 +2129,11 @@ set_title (GeditWindow *window)
 
 	if (window->priv->active_tab == NULL)
 	{
+#ifdef PLATFORM_OSX
+		gedit_osx_set_window_title (window, "gedit", NULL);
+#else
 		gtk_window_set_title (GTK_WINDOW (window), "gedit");
+#endif
 		return;
 	}
 
@@ -2206,7 +2213,11 @@ set_title (GeditWindow *window)
 						 name);
 	}
 
+#ifdef PLATFORM_OSX
+	gedit_osx_set_window_title (window, title, doc);
+#else
 	gtk_window_set_title (GTK_WINDOW (window), title);
+#endif
 
 	g_free (dirname);
 	g_free (name);
@@ -3113,13 +3124,35 @@ editable_changed (GeditView  *view,
 }
 
 static void
+update_sensitivity (GeditWindow *window)
+{
+	GtkAction *action;
+
+	/* Set sensitivity */
+	gtk_action_group_set_sensitive (window->priv->action_group,
+					window->priv->num_tabs != 0);
+
+	action = gtk_action_group_get_action (window->priv->action_group,
+					     "DocumentsMoveToNewWindow");
+	gtk_action_set_sensitive (action,
+				  window->priv->num_tabs > 1);
+
+	/* Set sensitivity */
+	if (window->priv->num_tabs == 0)
+	{
+		action = gtk_action_group_get_action (window->priv->action_group,
+						      "ViewHighlightMode");
+		gtk_action_set_sensitive (action, FALSE);
+	}
+}
+
+static void
 notebook_tab_added (GeditNotebook *notebook,
 		    GeditTab      *tab,
 		    GeditWindow   *window)
 {
 	GeditView *view;
 	GeditDocument *doc;
-	GtkAction *action;
 
 	gedit_debug (DEBUG_WINDOW);
 
@@ -3127,15 +3160,7 @@ notebook_tab_added (GeditNotebook *notebook,
 	
 	++window->priv->num_tabs;
 
-	/* Set sensitivity */
-	if (!gtk_action_group_get_sensitive (window->priv->action_group))
-		gtk_action_group_set_sensitive (window->priv->action_group,
-						TRUE);
-
-	action = gtk_action_group_get_action (window->priv->action_group,
-					     "DocumentsMoveToNewWindow");
-	gtk_action_set_sensitive (action,
-				  window->priv->num_tabs > 1);
+	update_sensitivity (window);
 
 	view = gedit_tab_get_view (tab);
 	doc = gedit_tab_get_document (tab);
@@ -3204,7 +3229,6 @@ notebook_tab_removed (GeditNotebook *notebook,
 {
 	GeditView     *view;
 	GeditDocument *doc;
-	GtkAction     *action;
 
 	gedit_debug (DEBUG_WINDOW);
 
@@ -3302,29 +3326,14 @@ notebook_tab_removed (GeditNotebook *notebook,
 		}
 	}
 
-	/* Set sensitivity */
+	update_sensitivity (window);
+
 	if (window->priv->num_tabs == 0)
 	{
-		if (gtk_action_group_get_sensitive (window->priv->action_group))
-			gtk_action_group_set_sensitive (window->priv->action_group,
-							FALSE);
-
-		action = gtk_action_group_get_action (window->priv->action_group,
-						      "ViewHighlightMode");
-		gtk_action_set_sensitive (action, FALSE);
-
 		gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
 							 window);
 	}
 
-	if (window->priv->num_tabs <= 1)
-	{
-		action = gtk_action_group_get_action (window->priv->action_group,
-						     "DocumentsMoveToNewWindow");
-		gtk_action_set_sensitive (action,
-					  FALSE);
-	}
-
 	update_window_state (window);
 
 	g_signal_emit (G_OBJECT (window), signals[TAB_REMOVED], 0, tab);	
@@ -3913,6 +3922,8 @@ gedit_window_init (GeditWindow *window)
 	 * This needs to be done after plugins activatation */
 	init_panels_visibility (window);
 
+	update_sensitivity (window);
+
 	gedit_debug_message (DEBUG_WINDOW, "END");
 }
 
@@ -3995,6 +4006,11 @@ gedit_window_create_tab (GeditWindow *window,
 				-1,
 				jump_to);
 
+	if (!GTK_WIDGET_VISIBLE (window))
+	{
+		gtk_window_present (GTK_WINDOW (window));
+	}
+
 	return tab;
 }
 
@@ -4040,7 +4056,13 @@ gedit_window_create_tab_from_uri (GeditWindow         *window,
 				GEDIT_TAB (tab),
 				-1,
 				jump_to);
-				
+
+
+	if (!GTK_WIDGET_VISIBLE (window))
+	{
+		gtk_window_present (GTK_WINDOW (window));
+	}
+
 	return GEDIT_TAB (tab);
 }				  
 
@@ -4470,8 +4492,7 @@ _gedit_window_fullscreen (GeditWindow *window)
 	g_signal_connect (window->priv->notebook, "notify::show-tabs",
 			  G_CALLBACK (hide_notebook_tabs_on_fullscreen), window);
 	
-	gtk_widget_hide (gtk_ui_manager_get_widget (window->priv->manager,
-			 "/MenuBar"));
+	gtk_widget_hide (window->priv->menubar);
 	
 	g_signal_handlers_block_by_func (window->priv->toolbar,
 					 toolbar_visibility_changed,
@@ -4504,7 +4525,7 @@ _gedit_window_unfullscreen (GeditWindow *window)
 					      hide_notebook_tabs_on_fullscreen,
 					      window);
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook), TRUE);
-	gtk_widget_show (gtk_ui_manager_get_widget (window->priv->manager, "/MenuBar"));
+	gtk_widget_show (window->priv->menubar);
 	
 	action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
 					      "ViewToolbar");
@@ -4632,3 +4653,8 @@ gedit_window_get_tab_from_uri (GeditWindow *window,
 	return tab;
 }
 
+GtkWidget *
+_gedit_window_get_menu_bar (GeditWindow *window)
+{
+	return window->priv->menubar;
+}
\ No newline at end of file
diff --git a/gedit/gedit-window.h b/gedit/gedit-window.h
index e8c7eef..4b30cf8 100644
--- a/gedit/gedit-window.h
+++ b/gedit/gedit-window.h
@@ -190,6 +190,8 @@ void		 _gedit_recent_add			(GeditWindow	     *window,
 void		 _gedit_recent_remove			(GeditWindow         *window,
 							 const gchar         *uri);
 
+GtkWidget 	*_gedit_window_get_menu_bar		(GeditWindow         *window);
+
 G_END_DECLS
 
 #endif  /* __GEDIT_WINDOW_H__  */
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 03a1705..33ee3d9 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -71,6 +71,10 @@
 #undef SAVE_DATADIR
 #endif
 
+#ifdef PLATFORM_OSX
+#include <ige-mac-dock.h>
+#endif
+
 static guint32 startup_timestamp = 0;
 
 #ifndef G_OS_WIN32
@@ -548,6 +552,9 @@ main (int argc, char *argv[])
 	gchar *dir;
 	gchar *icon_dir;
 
+	/* Init type system as soon as possible */
+	g_type_init ();
+
 	/* Init glib threads asap */
 	g_thread_init (NULL);
 
diff --git a/gedit/osx/Makefile.am b/gedit/osx/Makefile.am
new file mode 100644
index 0000000..6e4dc0a
--- /dev/null
+++ b/gedit/osx/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = 							\
+	-I$(top_srcdir)						\
+	-I$(top_builddir)					\
+	-I$(top_srcdir)/gedit 					\
+	-I$(top_builddir)/gedit					\
+	$(GEDIT_CFLAGS) 					\
+	$(WARN_CFLAGS)						\
+	$(DISABLE_DEPRECATED_CFLAGS)
+
+noinst_LTLIBRARIES = libosx.la
+
+libosx_la_LDFLAGS = -framework Carbon -framework ApplicationServices
+libosx_la_LIBADD = -lobjc
+libosx_la_CFLAGS = -xobjective-c
+
+libosx_la_SOURCES = 	\
+	gedit-osx.c 	\
+	gedit-osx.h
+
+-include $(top_srcdir)/git.mk
diff --git a/gedit/osx/gedit-osx.c b/gedit/osx/gedit-osx.c
new file mode 100644
index 0000000..397cee3
--- /dev/null
+++ b/gedit/osx/gedit-osx.c
@@ -0,0 +1,75 @@
+#include "gedit-osx.h"
+#include <gdk/gdkquartz.h>
+#include <Carbon/Carbon.h>
+
+void
+gedit_osx_set_window_title (GeditWindow   *window, 
+			    gchar const   *title,
+			    GeditDocument *document)
+{
+	NSWindow *native;
+
+	g_return_if_fail (GEDIT_IS_WINDOW (window));
+
+	if (GTK_WIDGET (window)->window == NULL)
+	{
+		return;
+	}
+
+	native = gdk_quartz_window_get_nswindow (GTK_WIDGET (window)->window);
+
+	if (document)
+	{
+		bool ismodified;
+
+		if (gedit_document_is_untitled (document))
+		{
+			[native setRepresentedURL:nil];
+		}
+		else
+		{
+			const gchar *uri = gedit_document_get_uri (document);
+			NSURL *nsurl = [NSURL URLWithString:[NSString stringWithUTF8String:uri]];
+			
+			[native setRepresentedURL:nsurl];
+		}
+
+		ismodified = !gedit_document_is_untouched (document); 
+		[native setDocumentEdited:ismodified];
+	}
+	else
+	{
+		[native setRepresentedURL:nil];
+		[native setDocumentEdited:false];
+	}
+
+	gtk_window_set_title (GTK_WINDOW (window), title);
+}
+
+gboolean
+gedit_osx_show_url (const gchar *url)
+{
+ 	return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]]];
+}
+
+gboolean
+gedit_osx_show_help (const gchar *link_id)
+{
+	gchar *link;
+	gboolean ret;
+
+	if (link_id)
+	{
+		link = g_strdup_printf ("http://library.gnome.org/users/gedit/stable/%s";,
+					link_id);
+	}
+	else
+	{
+		link = g_strdup ("http://library.gnome.org/users/gedit/stable/";);
+	}
+
+	ret = gedit_osx_show_url (link);
+	g_free (link);
+
+	return ret;
+}
diff --git a/gedit/osx/gedit-osx.h b/gedit/osx/gedit-osx.h
new file mode 100644
index 0000000..6564837
--- /dev/null
+++ b/gedit/osx/gedit-osx.h
@@ -0,0 +1,14 @@
+#ifndef __GEDIT_OSX_H__
+#define __GEDIT_OSX_H__
+
+#include <gtk/gtk.h>
+#include <gedit/gedit-window.h>
+
+void 	gedit_osx_set_window_title 	(GeditWindow   *window, 
+					 gchar const   *title,
+					 GeditDocument *document);
+
+gboolean gedit_osx_show_url 		(const gchar *url);
+gboolean gedit_osx_show_help		(const gchar *link_id);
+
+#endif /* __GEDIT_OSX_H__ */
diff --git a/osx/Info.plist b/osx/Info.plist
new file mode 100644
index 0000000..413d594
--- /dev/null
+++ b/osx/Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+<plist version="1.0">
+<dict>
+    <key>CFBundleDevelopmentRegion</key>
+    <string>English</string>
+    <key>CFBundleExecutable</key>
+    <string>gedit</string>
+    <key>CFBundleGetInfoString</key>
+    <string>2.26.2 Copyright 2009, gedit</string>
+    <key>CFBundleIconFile</key>
+    <string>gedit.icns</string>
+    <key>CFBundleIdentifier</key>
+    <string>org.gnome.gedit</string>
+    <key>CFBundleInfoDictionaryVersion</key>
+    <string>6.0</string>
+    <key>CFBundlePackageType</key>
+    <string>APPL</string>
+    <key>CFBundleShortVersionString</key>
+    <string>2.26.2</string>
+    <key>CFBundleSignature</key>
+    <string>????</string>
+    <key>CFBundleVersion</key>
+    <string>2.26.2</string>
+    <key>NSHumanReadableCopyright</key>
+    <string>Copyright 2009 gedit, GNU General Public License.</string>
+    <key>LSMinimumSystemVersion</key>
+    <string>10.4</string>
+</dict>
+</plist>
diff --git a/osx/dmg-data/background.png b/osx/dmg-data/background.png
new file mode 100644
index 0000000..6d0626f
Binary files /dev/null and b/osx/dmg-data/background.png differ
diff --git a/osx/dmg-data/background.svg b/osx/dmg-data/background.svg
new file mode 100644
index 0000000..0f92752
--- /dev/null
+++ b/osx/dmg-data/background.svg
@@ -0,0 +1,395 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="744.09448819"
+   height="1052.3622047"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.46"
+   sodipodi:docname="background.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   inkscape:export-filename="/Users/jesse/gtk/source/gedit/osx/dmg-data/background.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient9545">
+      <stop
+         style="stop-color:#a6d1ef;stop-opacity:1;"
+         offset="0"
+         id="stop9547" />
+      <stop
+         style="stop-color:#a8c5eb;stop-opacity:0;"
+         offset="1"
+         id="stop9549" />
+    </linearGradient>
+    <marker
+       inkscape:stockid="Arrow1Send"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Send"
+       style="overflow:visible;">
+      <path
+         id="path3874"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+         transform="scale(0.2) rotate(180) translate(6,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="TriangleOutM"
+       style="overflow:visible">
+      <path
+         id="path4005"
+         d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+         transform="scale(0.4)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="TriangleOutS"
+       style="overflow:visible">
+      <path
+         id="path4008"
+         d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+         transform="scale(0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Mend"
+       style="overflow:visible;">
+      <path
+         id="path3868"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+         transform="scale(0.4) rotate(180) translate(10,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Mend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Mend"
+       style="overflow:visible;">
+      <path
+         id="path3886"
+         style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         transform="scale(0.6) rotate(180) translate(0,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Lend"
+       style="overflow:visible;">
+      <path
+         id="path3880"
+         style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         transform="scale(1.1) rotate(180) translate(1,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Lend"
+       style="overflow:visible;">
+      <path
+         id="path3862"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+         transform="scale(0.8) rotate(180) translate(12.5,0)" />
+    </marker>
+    <linearGradient
+       id="linearGradient3155">
+      <stop
+         style="stop-color:#dae6fe;stop-opacity:1;"
+         offset="0"
+         id="stop3157" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop3159" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective10" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3155"
+       id="linearGradient3161"
+       x1="406.21429"
+       y1="621.43317"
+       x2="408.21429"
+       y2="321.4332"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(3,1)" />
+    <inkscape:perspective
+       id="perspective3251"
+       inkscape:persp3d-origin="571.97833 : 136.13385 : 1"
+       inkscape:vp_z="1143.9567 : 204.20078 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 204.20078 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         id="stop2793"
+         offset="0"
+         style="stop-color:#555753;stop-opacity:1;" />
+      <stop
+         style="stop-color:#cccdcb;stop-opacity:1;"
+         offset="0.5"
+         id="stop2799" />
+      <stop
+         id="stop2795"
+         offset="1"
+         style="stop-color:#555753;stop-opacity:1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2804">
+      <stop
+         id="stop2806"
+         offset="0"
+         style="stop-color:white;stop-opacity:1" />
+      <stop
+         id="stop2808"
+         offset="1"
+         style="stop-color:#d3d7cf;stop-opacity:1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3415">
+      <stop
+         id="stop3417"
+         offset="0"
+         style="stop-color:black;stop-opacity:0;" />
+      <stop
+         style="stop-color:black;stop-opacity:1;"
+         offset="0.5"
+         id="stop3423" />
+      <stop
+         id="stop3419"
+         offset="1"
+         style="stop-color:black;stop-opacity:0;" />
+    </linearGradient>
+    <inkscape:perspective
+       id="perspective3591"
+       inkscape:persp3d-origin="24 : 16 : 1"
+       inkscape:vp_z="48 : 24 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 24 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient9545"
+       id="linearGradient9551"
+       x1="450"
+       y1="454.36218"
+       x2="271"
+       y2="521.36218"
+       gradientUnits="userSpaceOnUse" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="452"
+     inkscape:cy="587"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1183"
+     inkscape:window-height="674"
+     inkscape:window-x="95"
+     inkscape:window-y="197" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <rect
+       style="fill:url(#linearGradient3161);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       id="rect2383"
+       width="499.49338"
+       height="299.49338"
+       x="132.46759"
+       y="322.68649" />
+    <g
+       id="g3254"
+       transform="matrix(0.157227,0,0,0.157227,466.1613,513.07606)"
+       style="fill:#0e3b76;fill-opacity:1">
+      <g
+         id="g15041"
+         transform="matrix(1.293235,0,0,1.293235,-4878.321,-1224.915)"
+         style="fill:#0e3b76;fill-opacity:1">
+        <g
+           id="g15043"
+           style="fill:#0e3b76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-miterlimit:4"
+           transform="matrix(2.438586,0,0,2.438586,3659.952,1113.451)">
+          <g
+             id="g15045"
+             style="fill:#0e3b76;fill-opacity:1">
+            <path
+               id="path15047"
+               style="fill:#0e3b76;fill-opacity:1"
+               d="M 86.068,0 C 61.466,0 56.851,35.041 70.691,35.041 C 84.529,35.041 110.671,0 86.068,0 z" />
+            <path
+               id="path15049"
+               style="fill:#0e3b76;fill-opacity:1"
+               d="M 45.217,30.699 C 52.586,31.149 60.671,2.577 46.821,4.374 C 32.976,6.171 37.845,30.249 45.217,30.699 z" />
+            <path
+               id="path15051"
+               style="fill:#0e3b76;fill-opacity:1"
+               d="M 11.445,48.453 C 16.686,46.146 12.12,23.581 3.208,29.735 C -5.7,35.89 6.204,50.759 11.445,48.453 z" />
+            <path
+               id="path15053"
+               style="fill:#0e3b76;fill-opacity:1"
+               d="M 26.212,36.642 C 32.451,35.37 32.793,9.778 21.667,14.369 C 10.539,18.961 19.978,37.916 26.212,36.642 L 26.212,36.642 z" />
+            <path
+               id="path15055"
+               style="fill:#0e3b76;fill-opacity:1"
+               d="M 58.791,93.913 C 59.898,102.367 52.589,106.542 45.431,101.092 C 22.644,83.743 83.16,75.088 79.171,51.386 C 75.86,31.712 15.495,37.769 8.621,68.553 C 3.968,89.374 27.774,118.26 52.614,118.26 C 64.834,118.26 78.929,107.226 81.566,93.248 C 83.58,82.589 57.867,86.86 58.791,93.913 L 58.791,93.913 z" />
+          </g>
+        </g>
+        <g
+           id="g15057"
+           style="fill:#0e3b76;fill-opacity:1">
+          <path
+             id="path15059"
+             style="font-size:148.69964600000000132px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             d="M 4176.2963,1214.4401 C 4161.1885,1214.847 4149.2577,1220.2768 4140.4837,1230.6901 C 4131.3976,1241.527 4126.8275,1256.5005 4126.8275,1275.5964 C 4126.8275,1294.6396 4131.3978,1309.5721 4140.4837,1320.4088 C 4149.6142,1331.2457 4162.1501,1336.6588 4178.14,1336.6588 C 4194.174,1336.6588 4206.7414,1331.2457 4215.8275,1320.4088 C 4224.9134,1309.5721 4229.4526,1294.6396 4229.4525,1275.5964 C 4229.4524,1256.5005 4224.9134,1241.527 4215.8275,1230.6901 C 4206.7414,1219.8535 4194.1739,1214.4402 4178.14,1214.4401 C 4177.5154,1214.4401 4176.9104,1214.4236 4176.2963,1214.4401 z M 4177.4213,1236.4401 C 4177.6628,1236.4334 4177.895,1236.4401 4178.14,1236.4401 C 4186.0233,1236.4402 4192.1319,1239.8515 4196.4525,1246.6901 C 4200.7728,1253.5289 4202.9524,1263.1814 4202.9525,1275.5964 C 4202.9525,1287.9587 4200.7726,1297.5391 4196.4525,1304.3776 C 4192.1321,1311.2165 4186.0232,1314.6588 4178.14,1314.6588 C 4170.3009,1314.6588 4164.2417,1311.2165 4159.9213,1304.3776 C 4155.600
 9,1297.5391 4153.4214,1287.9587 4153.4213,1275.5964 C 4153.4213,1263.1815 4155.6011,1253.5289 4159.9213,1246.6901 C 4164.1065,1240.0652 4169.9336,1236.6473 4177.4213,1236.4401 z" />
+          <path
+             id="path15061"
+             style="font-size:148.69964600000000132px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             d="M 4005.6293,1325.612 C 3992.3217,1336.7877 3972.5226,1336.6592 3964.2744,1336.6592 C 3947.6611,1336.6592 3934.4997,1331.1882 3924.7902,1320.2462 C 3915.0805,1309.2516 3910.2258,1294.3643 3910.2258,1275.584 C 3910.2258,1256.5934 3915.1696,1241.6535 3925.0574,1230.764 C 3934.9452,1219.8748 3948.4851,1214.4301 3965.6774,1214.43 C 3972.3137,1214.4301 3978.6605,1215.1666 3984.718,1216.6394 C 3990.8199,1218.1124 3996.5655,1220.2956 4001.9548,1223.1888 L 3995.0338,1243.6496 C 3992.004,1241.991 3988.5351,1240.3564 3985.3193,1239.2072 C 3979.8409,1237.3661 3974.3403,1236.4455 3968.8175,1236.4454 C 3958.5733,1236.4455 3950.6675,1239.8386 3945.1002,1246.6246 C 3939.5772,1253.3582 3936.8158,1263.0113 3936.8158,1275.584 C 3936.8158,1288.0516 3939.4881,1297.6785 3944.833,1304.4646 C 3950.1776,1311.2507 3958.2098,1314.6437 3967.6148,1314.6437 C 3977.1696,1314.6437 3983.0876,1312.2353 3986.2439,1309.6976 L 3986.2439,1289.3141 L 3965.5438,1289.3141 L 3965.5438,1268.9557 L 400
 5.6293,1268.9557" />
+          <path
+             id="path15063"
+             style="font-size:148.69964600000000132px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             d="M 4023.2108,1216.5605 L 4039.4387,1216.5605 L 4090.7162,1287.3627 L 4090.7162,1216.5605 L 4112.6015,1216.5605 L 4112.6015,1334.3708 L 4096.3736,1334.3708 L 4045.0962,1263.5686 L 4045.0962,1334.3708 L 4023.2108,1334.3708 L 4023.2108,1216.5605" />
+          <path
+             id="path15065"
+             style="font-size:148.69964600000000132px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             d="M 4246.3361,1216.5605 L 4279.0727,1216.5605 L 4301.7878,1290.1084 L 4324.6365,1216.5605 L 4352.3063,1216.5605 L 4364.8063,1334.3708 L 4340.4877,1334.3708 L 4332.9877,1260.7028 L 4310.0054,1334.7241 L 4293.7039,1334.7241 L 4270.7215,1258.2028 L 4263.2215,1334.3708 L 4238.8361,1334.3708 L 4251.3361,1216.5605" />
+          <path
+             id="path15067"
+             style="font-size:148.69964600000000132px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             d="M 4382.3597,1216.5605 L 4451.7744,1216.5605 L 4451.7744,1239.5229 L 4408.0811,1239.5229 L 4408.0811,1263.9594 L 4441.6688,1263.9594 L 4441.6688,1284.4217 L 4408.0811,1284.4217 L 4408.0811,1311.4085 L 4453.2442,1311.4085 L 4453.2442,1334.3708 L 4382.3597,1334.3708 L 4382.3597,1216.5605" />
+          <text
+             xml:space="preserve"
+             id="text15069"
+             style="font-size:30.68958854999999986px;font-style:normal;font-weight:normal;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+             y="1215.743"
+             x="4474.6182"><tspan
+               id="tspan15072"
+               style="letter-spacing:11.06259632000000082;fill:#0e3b76;fill-opacity:1"
+               y="1215.743"
+               x="4474.6182"><tspan
+                 id="tspan15074"
+                 style="letter-spacing:0.25238149999999998;fill:#0e3b76;fill-opacity:1">TM</tspan></tspan></text>
+        </g>
+      </g>
+    </g>
+    <g
+       id="g3798"
+       transform="translate(-17.129471,0)">
+      <text
+         id="text3790"
+         y="384.36218"
+         x="264"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:#c5c5c5;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#c5c5c5;fill-opacity:1;font-family:Sans;-inkscape-font-specification:Sans Bold"
+           y="384.36218"
+           x="264"
+           id="tspan3792"
+           sodipodi:role="line">Install gedit</tspan></text>
+      <text
+         xml:space="preserve"
+         style="font-size:40px;font-style:normal;font-weight:normal;fill:#0e3b76;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+         x="260"
+         y="382.36218"
+         id="text3794"><tspan
+           sodipodi:role="line"
+           id="tspan3796"
+           x="260"
+           y="382.36218"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#0e3b76;fill-opacity:1;font-family:Sans;-inkscape-font-specification:Sans Bold">Install gedit</tspan></text>
+    </g>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       x="169"
+       y="437.36218"
+       id="text9527"><tspan
+         sodipodi:role="line"
+         id="tspan9529"
+         x="169"
+         y="437.36218"
+         style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#505050;fill-opacity:1;font-family:Sans;-inkscape-font-specification:Sans">Drag this...</tspan></text>
+    <text
+       id="text9531"
+       y="527.36218"
+       x="380"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+       xml:space="preserve"><tspan
+         style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#505050;fill-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
+         y="527.36218"
+         x="380"
+         id="tspan9533"
+         sodipodi:role="line">... onto this</tspan></text>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:url(#linearGradient9551);stroke-width:20;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1"
+       d="M 262,517.36218 C 262,517.36218 337,457.36218 435,457.36218"
+       id="path9535"
+       sodipodi:nodetypes="cs" />
+    <path
+       style="fill:#a6d1ef;fill-opacity:1;stroke:#4178ce;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 434.32487,429.73325 L 462.53555,457.94393 L 434.32487,486.15461 L 434.32487,429.73325 z"
+       id="rect9553"
+       sodipodi:nodetypes="cccc" />
+  </g>
+</svg>
diff --git a/osx/gedit.bundle b/osx/gedit.bundle
new file mode 100644
index 0000000..b35058f
--- /dev/null
+++ b/osx/gedit.bundle
@@ -0,0 +1,110 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<app-bundle>
+
+  <meta>
+    <!-- Where to pick up the GTK+ installation, icon themes,
+         etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the
+         value of the environment variable JHBUILD_PREFIX. You can
+         define additional prefixes and refer to them in paths
+         throughout this file on the form "${prefix:name}". This is
+         useful for installing certain libraries or even the
+         application itself separately. Note that JHBUILD_PREFIX is
+         defined by jhbuild, so it you are not using jhbuild you can
+         either define your own or just hardcode the path here.
+    -->
+    <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
+
+    <!-- The project directory is the default location of the created
+         app. If you leave out the path, the current directory is
+         used. Note the usage of an environment variable here again.
+    <destination overwrite="yes">${env:HOME}/Desktop</destination>
+    -->
+    
+    <image>
+      <!-- Not implemented yet (DMG image). -->
+    </image>
+
+    <!-- Optionally specify a launcher script to use. If the
+         application sets up everything needed itself, like
+         environment variable, linker paths, etc, a launcher script is
+         not needed. If the source path is left out, the default
+         script will be used.
+    -->
+    <launcher-script>${project}/launcher.sh</launcher-script>
+  </meta>
+
+  <!-- The special macro "${project}" refers to the directory where
+       this bundle file is located. The application name and bundle
+       identifier are taken from the plist file.
+  -->
+  <plist>${project}/Info.plist</plist>
+
+  <main-binary>${prefix}/bin/gedit</main-binary>
+
+  <!-- Copy in GTK+ modules -->
+  <binary>${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/loaders/*.so</binary>
+
+  <!-- Copy in GTK+ theme engines -->
+  <binary>${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/engines/*.so</binary>
+
+  <!-- Copy in GTK+ printer backends -->
+  <binary>${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/printbackends/*.so</binary>
+
+  <!-- Copy in GTK+ im modules -->
+  <binary>${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/immodules/*.so</binary>
+
+  <!-- Copy in plugins and plugin loaders -->
+  <binary>${prefix}/lib/gedit-2/plugin-loaders/*.so</binary>
+  <binary>${prefix}/lib/gedit-2/plugins/*.so</binary>
+
+  <!-- Python gtk binaries -->
+  <binary>${prefix}/lib/python2.5/site-packages/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/cairo/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/gtk-2.0/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/gtk-2.0/gio/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/gtk-2.0/glib/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/gtk-2.0/gobject/*.so</binary>
+  <binary>${prefix}/lib/python2.5/site-packages/gtk-2.0/gtk/*.so</binary>
+
+  <!-- Python others -->
+  <data>${prefix}/lib/python2.5/site-packages</data>
+
+  <!-- gconf -->
+  <data>${prefix}/etc/gconf/2</data>
+  <data>${prefix}/etc/gconf/schemas</data>
+  <data>${prefix}/etc/gconf/*.xml</data>
+  <data>${prefix}/libexec/gconfd-2</data>
+  <data>${prefix}/libexec/gedit-2</data>
+  <data>${prefix}/lib/GConf</data>
+
+  <!-- gtksourceview -->
+  <data>${prefix}/share/gtksourceview-2.0</data>
+
+  <!-- gtkengines -->
+  <data>${prefix}/share/gtk-engines</data>
+
+  <!-- gedit -->
+  <data>${prefix}/share/gedit-2</data>
+  <data>${prefix}/lib/gedit-2</data>
+
+  <!-- locale (TODO: trim) -->
+  <data>${prefix}/share/locale</data>
+  <data>${prefix}/lib/charset.alias</data>
+
+  <!-- Themes (TODO: trim files) -->
+  <data>${prefix}/share/themes</data>
+
+  <!-- App icon -->
+  <data dest="${bundle}/Contents/Resources">${project}/gedit.icns</data>
+
+  <!-- Custom theme settings -->
+  <data dest="${bundle}/Contents/Resources/etc/gtk-2.0/gtkrc">${project}/gtkrc</data>
+
+  <!-- Icon theme -->
+  <icon-theme icons="auto">Tango</icon-theme>
+  <data>${prefix}/share/icons/gnome/16x16/apps/system-file-manager.png</data>
+  <data>${prefix}/share/icons/gnome/22x22/apps/system-file-manager.png</data>
+  <data>${prefix}/share/icons/gnome/24x24/apps/system-file-manager.png</data>
+  <data>${prefix}/share/icons/gnome/32x32/apps/system-file-manager.png</data>
+  <data>${prefix}/share/icons/gnome/scalable/apps/system-file-manager.svg</data>
+</app-bundle>
diff --git a/osx/gedit.icns b/osx/gedit.icns
new file mode 100644
index 0000000..ccd50be
Binary files /dev/null and b/osx/gedit.icns differ
diff --git a/osx/gtkrc b/osx/gtkrc
new file mode 100644
index 0000000..bcc2542
--- /dev/null
+++ b/osx/gtkrc
@@ -0,0 +1,428 @@
+
+# Please keep this gtkrc in sync with the other ones from Clearlooks based themes.
+
+gtk-color-scheme = "base_color:#ffffff\nfg_color:#000000\ntooltip_fg_color:#000000\nselected_bg_color:#86ABD9\nselected_fg_color:#ffffff\ntext_color:#1A1A1A\nbg_color:#EDECEB\ntooltip_bg_color:#F5F5B5"
+
+gtk-icon-theme-name = "Tango"
+
+gtk-toolbar-style = GTK_TOOLBAR_ICONS
+
+style "default" {
+	xthickness = 1
+	ythickness = 1
+
+	#######################
+	# Style Properties
+	#######################
+	GtkButton::child-displacement-x = 1
+	GtkButton::child-displacement-y = 1
+	GtkButton::default-border = { 0, 0, 0, 0 }
+
+	GtkCheckButton::indicator-size = 14
+
+	GtkPaned::handle-size = 6
+
+	GtkRange::trough-border = 0
+	GtkRange::slider-width = 15
+	GtkRange::stepper-size = 15
+
+	GtkScale::slider-length = 23
+	GtkScale::trough-side-details = 1
+
+	GtkScrollbar::min-slider-length = 30
+	GtkMenuBar::internal-padding = 0
+	GtkExpander::expander-size = 16
+	GtkToolbar::internal-padding = 1
+	GtkTreeView::expander-size = 14
+	GtkTreeView::vertical-separator = 0
+
+	GtkMenu::horizontal-padding = 0
+	GtkMenu::vertical-padding = 0
+
+	WnckTasklist::fade-overlay-rect = 0
+	# The following line hints to gecko (and possibly other appliations)
+	# that the entry should be drawn transparently on the canvas.
+	# Without this, gecko will fill in the background of the entry.
+	GtkEntry::honors-transparent-bg-hint = 1
+
+	GtkEntry::progress-border = { 2, 2, 2, 2 }
+
+	####################
+	# Color Definitions
+	####################
+	bg[NORMAL]        = @bg_color
+	bg[PRELIGHT]      = shade (1.02, @bg_color)
+	bg[SELECTED]      = @selected_bg_color
+	bg[INSENSITIVE]   = @bg_color
+	bg[ACTIVE]        = shade (0.9, @bg_color)
+
+	fg[NORMAL]        = @fg_color
+	fg[PRELIGHT]      = @fg_color
+	fg[SELECTED]      = @selected_fg_color
+	fg[INSENSITIVE]   = darker (@bg_color)
+	fg[ACTIVE]        = @fg_color
+
+	text[NORMAL]      = @text_color
+	text[PRELIGHT]    = @text_color
+	text[SELECTED]    = @selected_fg_color
+	text[INSENSITIVE] = darker (@bg_color)
+	text[ACTIVE]      = @selected_fg_color
+
+	base[NORMAL]      = @base_color
+	base[PRELIGHT]    = shade (0.95, @bg_color)
+	base[SELECTED]    = @selected_bg_color
+	base[INSENSITIVE] = @bg_color
+	base[ACTIVE]      = shade (0.9, @selected_bg_color)
+
+	engine "clearlooks" {
+		colorize_scrollbar = TRUE
+		reliefstyle = 1
+		menubarstyle = 2
+		toolbarstyle = 1
+		animation = FALSE
+		radius = 3.0
+		style = GUMMY
+
+		# Set a hint to disable backward compatibility fallbacks.
+		hint = "use-hints"
+	}
+}
+
+style "wide" {
+	xthickness = 2
+	ythickness = 2
+}
+
+style "wider" {
+	xthickness = 3
+	ythickness = 3
+}
+
+style "entry" {
+	xthickness = 3
+	ythickness = 3
+
+	bg[SELECTED] = mix (0.4, @selected_bg_color, @base_color)
+	fg[SELECTED] = @text_color
+
+	engine "clearlooks" {
+		focus_color = shade (0.65, @selected_bg_color)
+	}
+}
+
+style "spinbutton" {
+
+	engine "clearlooks" {
+		hint = "spinbutton"
+	}
+}
+
+style "scale" {
+	xthickness = 2
+	ythickness = 2
+
+	engine "clearlooks" {
+		hint = "scale"
+	}
+}
+
+style "vscale" {
+
+	engine "clearlooks" {
+		hint = "vscale"
+	}
+}
+
+style "hscale" {
+
+	engine "clearlooks" {
+		hint = "hscale"
+	}
+}
+
+style "scrollbar" {
+	xthickness = 2
+	ythickness = 2
+
+	engine "clearlooks" {
+		hint = "scrollbar"
+	}
+}
+
+style "hscrollbar" {
+
+	engine "clearlooks" {
+		hint = "hscrollbar"
+	}
+}
+
+style "vscrollbar" {
+
+	engine "clearlooks" {
+		hint = "vscrollbar"
+	}
+}
+
+style "notebook_bg" {
+
+	bg[NORMAL]        = shade (1.02, @bg_color)
+}
+
+style "button" {
+	xthickness = 3
+	ythickness = 3
+
+	bg[NORMAL]        = shade (1.04, @bg_color)
+	bg[PRELIGHT]      = shade (1.06, @bg_color)
+	bg[ACTIVE]        = shade (0.85, @bg_color)
+}
+
+# The color is changed by the notebook_bg style, this style
+# changes the x/ythickness
+style "notebook" {
+	xthickness = 3
+	ythickness = 3
+}
+
+style "statusbar" {
+
+	engine "clearlooks" {
+		hint = "statusbar"
+	}
+}
+
+style "comboboxentry" {
+
+	engine "clearlooks" {
+		# Note:
+		# If you set the appears-as-list option on comboboxes in the theme,
+		# then you should set this hint on the combobox instead.
+		hint = "comboboxentry"
+	}
+}
+
+style "menubar" {
+
+	engine "clearlooks" {
+		hint = "menubar"
+	}
+}
+
+style "menu" {
+	xthickness = 0
+	ythickness = 0
+
+	bg[NORMAL]        = shade (1.08, @bg_color)
+
+	engine "clearlooks" {
+		radius = 0.0
+	}
+}
+
+style "menu_item" {
+	xthickness = 2
+	ythickness = 3
+
+	fg[PRELIGHT]      = @selected_fg_color
+}
+
+# This style is there to modify the separator menu items. The goals are:
+# 1. Get a specific height.
+# 2. The line should go to the edges (ie. no border at the left/right)
+style "separator_menu_item" {
+	xthickness = 1
+	ythickness = 0
+
+	GtkSeparatorMenuItem::horizontal-padding = 0
+	GtkWidget::wide-separators = 1
+	GtkWidget::separator-width = 1
+	GtkWidget::separator-height = 7
+}
+
+style "frame_title" {
+
+	fg[NORMAL]        = lighter (@fg_color)
+}
+
+style "treeview" {
+
+	engine "clearlooks" {
+		hint = "treeview"
+	}
+}
+
+# The almost useless progress bar style
+style "progressbar" {
+	xthickness = 1
+	ythickness = 1
+
+	fg[PRELIGHT]      = @selected_fg_color
+
+	engine "clearlooks" {
+		# Explicitly set the radius for the progress bars inside menu items.
+		radius = 3.0
+
+		hint = "progressbar"
+	}
+}
+
+# This style is based on the default style, so that the colors from the button
+# style are overriden again.
+style "treeview_header" = "default" {
+	xthickness = 2
+	ythickness = 1
+
+	engine "clearlooks" {
+		hint = "treeview-header"
+	}
+}
+
+style "tooltips" {
+	xthickness = 4
+	ythickness = 4
+
+	bg[NORMAL]        = @tooltip_bg_color
+	fg[NORMAL]        = @tooltip_fg_color
+}
+
+style "nautilus_location" {
+
+	bg[NORMAL]        = mix (0.60, shade (1.05, @bg_color), @selected_bg_color)
+}
+
+# Wrokaroudn style for places where the text color is used instead of the fg color.
+style "text_is_fg_color_workaround" {
+
+	text[NORMAL]      = @fg_color
+	text[PRELIGHT]    = @fg_color
+	text[SELECTED]    = @selected_fg_color
+	text[ACTIVE]      = @fg_color
+	text[INSENSITIVE] = darker (@bg_color)
+}
+
+# Workaround style for menus where the text color is used instead of the fg color.
+style "menuitem_text_is_fg_color_workaround" {
+
+	text[NORMAL]      = @fg_color
+	text[PRELIGHT]    = @selected_fg_color
+	text[SELECTED]    = @selected_fg_color
+	text[ACTIVE]      = @fg_color
+	text[INSENSITIVE] = darker (@bg_color)
+}
+
+# Workaround style for places where the fg color is used instead of the text color.
+style "fg_is_text_color_workaround" {
+
+	fg[NORMAL]        = @text_color
+	fg[PRELIGHT]      = @text_color
+	fg[SELECTED]      = @selected_fg_color
+	fg[ACTIVE]        = @selected_fg_color
+	fg[INSENSITIVE]   = darker (@bg_color)
+}
+
+# Style to set the toolbar to use a flat style. This is because the "New" button in
+# Evolution is not drawn transparent. So if there is a gradient in the background it will
+# look really wrong.
+# See http://bugzilla.gnome.org/show_bug.cgi?id=446953.
+style "evo_new_button_workaround" {
+
+	engine "clearlooks" {
+		toolbarstyle = 0
+	}
+}
+
+
+###############################################################################
+# The following part of the gtkrc applies the different styles to the widgets.
+###############################################################################
+
+# The default style is applied to every widget
+class "GtkWidget" style "default"
+
+class "GtkSeparator" style "wide"
+class "GtkFrame" style "wide"
+class "GtkCalendar" style "wide"
+class "GtkEntry" style "entry"
+
+class "GtkSpinButton" style "spinbutton"
+class "GtkScale" style "scale"
+class "GtkVScale" style "vscale"
+class "GtkHScale" style "hscale"
+class "GtkScrollbar" style "scrollbar"
+class "GtkHScrollbar" style "hscrollbar"
+class "GtkVScrollbar" style "vscrollbar"
+
+# General matching follows. The order is choosen so that the right styles override
+# each other. EG. progressbar needs to be more important than the menu match.
+widget_class "*<GtkNotebook>" style "notebook_bg"
+# This is not perfect, it could be done better.
+# (That is modify *every* widget in the notebook, and change those back that
+# we really don't want changed)
+widget_class "*<GtkNotebook>*<GtkEventBox>" style "notebook_bg"
+widget_class "*<GtkNotebook>*<GtkDrawingArea>" style "notebook_bg"
+widget_class "*<GtkNotebook>*<GtkLayout>" style "notebook_bg"
+widget_class "*<GtkNotebook>*<GtkViewport>" style "notebook_bg"
+widget_class "*<GtkNotebook>*<GtkScrolledWindow>" style "notebook_bg"
+
+widget_class "*<GtkButton>" style "button"
+widget_class "*<GtkNotebook>" style "notebook"
+widget_class "*<GtkStatusbar>*" style "statusbar"
+
+widget_class "*<GtkComboBoxEntry>*" style "comboboxentry"
+widget_class "*<GtkCombo>*" style "comboboxentry"
+
+widget_class "*<GtkMenuBar>*" style "menubar"
+widget_class "*<GtkMenu>*" style "menu"
+widget_class "*<GtkMenuItem>*" style "menu_item"
+widget_class "*<GtkSeparatorMenuItem>*" style "separator_menu_item"
+
+widget_class "*.<GtkFrame>.<GtkLabel>" style "frame_title"
+widget_class "*.<GtkTreeView>*" style "treeview"
+
+widget_class "*<GtkProgress>" style "progressbar"
+
+# Treeview headers (and similar stock GTK+ widgets)
+widget_class "*.<GtkTreeView>.<GtkButton>" style "treeview_header"
+widget_class "*.<GtkCTree>.<GtkButton>" style "treeview_header"
+widget_class "*.<GtkList>.<GtkButton>" style "treeview_header"
+widget_class "*.<GtkCList>.<GtkButton>" style "treeview_header"
+
+# The window of the tooltip is called "gtk-tooltip"
+##################################################################
+# FIXME:
+# This will not work if one embeds eg. a button into the tooltip.
+# As far as I can tell right now we will need to rework the theme
+# quite a bit to get this working correctly.
+# (It will involve setting different priorities, etc.)
+##################################################################
+widget "gtk-tooltip*" style "tooltips"
+
+##########################################################################
+# Following are special cases and workarounds for issues in applications.
+##########################################################################
+
+# Workaround for the evolution ETable (bug #527532)
+widget_class "*.ETable.ECanvas" style "treeview_header"
+# Workaround for the evolution ETree
+widget_class "*.ETree.ECanvas" style "treeview_header"
+
+# Special case the nautilus-extra-view-widget
+# ToDo: A more generic approach for all applications that have a widget like this.
+widget "*.nautilus-extra-view-widget" style : highest "nautilus_location"
+
+# Work around for http://bugzilla.gnome.org/show_bug.cgi?id=382646
+# Note that this work around assumes that the combobox is _not_ in appears-as-list mode.
+widget_class "*.<GtkComboBox>.<GtkCellView>" style "text_is_fg_color_workaround"
+# This is the part of the workaround that fixes the menus
+widget "*.gtk-combobox-popup-menu.*" style "menuitem_text_is_fg_color_workaround"
+
+# Work around the usage of GtkLabel inside GtkListItems to display text.
+# This breaks because the label is shown on a background that is based on the base color.
+widget_class "*<GtkListItem>*" style "fg_is_text_color_workaround"
+# GtkCList also uses the fg color to draw text on top of the base colors.
+widget_class "*<GtkCList>" style "fg_is_text_color_workaround"
+# Nautilus when renaming files, and maybe other places.
+widget_class "*<EelEditableLabel>" style "fg_is_text_color_workaround"
+
+# See the documentation of the style.
+widget_class "EShellWindow.GtkVBox.BonoboDock.BonoboDockBand.BonoboDockItem*" style "evo_new_button_workaround"
diff --git a/osx/launcher.sh b/osx/launcher.sh
new file mode 100755
index 0000000..9f6b4d6
--- /dev/null
+++ b/osx/launcher.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+if test "x$IGE_DEBUG_LAUNCHER" != x; then
+    set -x
+fi
+
+if test "x$IGE_DEBUG_GDB" != x; then
+    EXEC="gdb --args"
+else
+    EXEC=exec
+fi
+
+name="`basename $0`"
+tmp="`pwd`/$0"
+tmp=`dirname "$tmp"`
+tmp=`dirname "$tmp"`
+bundle=`dirname "$tmp"`
+bundle_contents="$bundle"/Contents
+bundle_res="$bundle_contents"/Resources
+bundle_lib="$bundle_res"/lib
+bundle_bin="$bundle_res"/bin
+bundle_data="$bundle_res"/share
+bundle_etc="$bundle_res"/etc
+
+export DYLD_LIBRARY_PATH="$bundle_lib:$DYLD_LIBRARY_PATH"
+export XDG_CONFIG_DIRS="$bundle_etc/xdg:$XDG_CONFIG_DIRS"
+export XDG_DATA_DIRS="$bundle_data:$XDG_DATA_DIRS"
+export GTK_DATA_PREFIX="$bundle_res"
+export GTK_EXE_PREFIX="$bundle_res"
+export GTK_PATH="$bundle_res"
+export GCONF_PREFIX="$bundle_res"
+
+export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
+export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
+export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
+export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
+
+# Python path
+export PYTHONPATH="$bundle_lib/python2.5/site-packages:$bundle_lib/python2.5/site-packages/gtk-2.0:$PYTHONPATH"
+
+if test -f "$bundle_lib/charset.alias"; then
+    export CHARSETALIASDIR="$bundle_lib"
+fi
+
+# Extra arguments can be added in environment.sh.
+EXTRA_ARGS=
+if test -f "$bundle_res/environment.sh"; then
+  source "$bundle_res/environment.sh"
+fi
+
+# Strip out the argument added by the OS.
+if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
+    shift 1
+fi
+
+# Start gconf first
+$bundle_res/libexec/gconfd-2 &
+
+$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS
diff --git a/osx/makebundle.sh b/osx/makebundle.sh
new file mode 100755
index 0000000..493c336
--- /dev/null
+++ b/osx/makebundle.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ -d gedit.app ] && [ "$1x" = "-fx" ]; then
+	rm -rf gedit.app
+fi
+
+ige-mac-bundler gedit.bundle
+
+# Strip debug symbols
+find gedit.app/Contents/Resources | grep -E '\.(so|dylib)' | xargs strip -S
+find gedit.app/Contents/Resources/bin | xargs strip -S
+strip -S gedit.app/Contents/MacOS/gedit-bin
\ No newline at end of file
diff --git a/osx/makedmg.sh b/osx/makedmg.sh
new file mode 100755
index 0000000..d8ecb23
--- /dev/null
+++ b/osx/makedmg.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Copied and modified from Banshee
+
+pushd $(dirname $0) &>/dev/null
+
+echo "Generating bundle..."
+./makebundle.sh -f
+
+VOLUME_NAME=gedit
+
+if [ "$1x" = "x" ]; then
+	DMG_FILE=$VOLUME_NAME.dmg
+else
+	DMG_FILE=$1.dmg
+fi
+
+DMG_APP=gedit.app
+MOUNT_POINT=$VOLUME_NAME.mounted
+
+rm -f $DMG_FILE
+rm -f $DMG_FILE.master
+
+# Compute an approximated image size in MB, and bloat by 10 MB
+image_size=$(du -ck $DMG_APP dmg-data | tail -n1 | cut -f1)
+image_size=$((($image_size + 10000) / 1000))
+
+echo "Creating disk image (${image_size}MB)..."
+#hdiutil create $DMG_FILE -megabytes $image_size -volname $VOLUME_NAME -fs HFS+ -quiet || exit $?
+cp template.dmg tmp.dmg
+hdiutil resize -size ${image_size}m tmp.dmg
+
+echo "Attaching to disk image..."
+hdiutil attach tmp.dmg -readwrite -noautoopen -mountpoint $MOUNT_POINT -quiet
+
+echo "Populating image..."
+cp -r $DMG_APP $MOUNT_POINT
+
+echo "Detaching from disk image..."
+hdiutil detach $MOUNT_POINT -quiet
+
+rm -rf $DMG_APP
+
+#mv $DMG_FILE $DMG_FILE.master
+
+#echo "Creating distributable image..."
+#hdiutil convert -quiet -format UDBZ -o $DMG_FILE $DMG_FILE.master
+
+#echo "Installing end user license agreement..."
+#hdiutil flatten -quiet $DMG_FILE
+#/Developer/Tools/Rez /Developer/Headers/FlatCarbon/*.r dmg-data/license.r -a -o $DMG_FILE
+#hdiutil unflatten -quiet $DMG_FILE
+
+echo "Converting to final image..."
+hdiutil convert -quiet -format UDBZ -o $DMG_FILE tmp.dmg
+rm tmp.dmg
+
+echo "Done."
+
+#if [ ! "x$1" = "x-m" ]; then
+#	rm $DMG_FILE.master
+#fi
+
+popd &>/dev/null
diff --git a/osx/template.dmg b/osx/template.dmg
new file mode 100644
index 0000000..b71c47d
Binary files /dev/null and b/osx/template.dmg differ



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