[geany/geany] 60bda5: Check whether the current document changed when Geany window activated

Jiří Techet git-noreply at xxxxx
Wed Nov 4 20:35:24 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Wed, 04 Nov 2015 20:35:24 UTC
Commit:      60bda546264af1efc863cd3a264e9a24cb7bea1a
             https://github.com/geany/geany/commit/60bda546264af1efc863cd3a264e9a24cb7bea1a

Log Message:
-----------
Check whether the current document changed when Geany window activated

This captures the common case when e.g. changing the document outside
Geany and switching back to Geany.

Remove the osx-specific code doing the same for osx only.


Modified Paths:
--------------
    src/libmain.c
    src/osx.c

Modified: src/libmain.c
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -222,6 +222,15 @@ static void apply_settings(void)
 }
 
 
+static void on_window_active_changed(GtkWindow *window, GParamSpec *pspec, gpointer data)
+{
+	GeanyDocument *doc = document_get_current();
+
+	if (doc && gtk_window_is_active(window))
+		document_check_disk_status(doc, TRUE);
+}
+
+
 static void main_init(void)
 {
 	/* add our icon path in case we aren't installed in the system prefix */
@@ -248,6 +257,7 @@ static void main_init(void)
 	main_status.opening_session_files	= FALSE;
 
 	main_widgets.window = create_window1();
+	g_signal_connect(main_widgets.window, "notify::is-active", G_CALLBACK(on_window_active_changed), NULL);
 
 	/* add recent projects to the Project menu */
 	ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1");


Modified: src/osx.c
10 lines changed, 0 insertions(+), 10 deletions(-)
===================================================================
@@ -86,14 +86,6 @@ static void on_new_window(GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_dat
 }
 
 
-static void app_active_cb(GtkosxApplication* app, G_GNUC_UNUSED gpointer user_data)
-{
-	GeanyDocument *doc = document_get_current();
-	if (doc)
-		document_check_disk_status(doc, TRUE);
-}
-
-
 void osx_ui_init(void)
 {
 	GtkWidget *item, *menu;
@@ -118,8 +110,6 @@ void osx_ui_init(void)
 					G_CALLBACK(app_block_termination_cb), NULL);
 	g_signal_connect(osx_app, "NSApplicationOpenFile",
 					G_CALLBACK(app_open_file_cb), NULL);
-	g_signal_connect(osx_app, "NSApplicationDidBecomeActive",
-					G_CALLBACK(app_active_cb), NULL);
 
 	menu = gtk_menu_new();
 	item = gtk_menu_item_new_with_label("New Window");



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list