Commit 5e764a41 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

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

parent 29ad26ea
......@@ -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
......
......@@ -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>
......
## 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 \
......
......@@ -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;
}
......
......@@ -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 |
......
......@@ -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;
......
......@@ -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)
......
......@@ -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"
......
......@@ -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",
......
......@@ -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 */
......
......@@ -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);
......@@ -3112,6 +3123,29 @@ editable_changed (GeditView *view,
window);
}
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,
......@@ -3119,7 +3153,6 @@ notebook_tab_added (GeditNotebook *notebook,
{
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));
}