mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:43:25 +00:00
Consistent Quit behavior on the Mac
We were responding to the wrong Quit signal on MacOS. The one we picked was the one that basically told us "it's too late to stop me, I'm quitting". I switched this to the one asking "should I prevent the app from quitting" and now we can indeed cancel the Quit, regardless which method was used to close the app. Also removes to unused variables. Fixes #22 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a72597189d
commit
c9a03db480
3 changed files with 3 additions and 4 deletions
|
@ -65,6 +65,7 @@ extern const char *subsurface_icon_name(void);
|
|||
extern void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||
GtkWidget *vbox, GtkUIManager *ui_manager);
|
||||
extern void quit(GtkWidget *w, gpointer data);
|
||||
extern gboolean on_delete(GtkWidget* w, gpointer data);
|
||||
|
||||
extern int is_default_dive_computer_device(const char *name);
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ static void file_open(GtkWidget *w, gpointer data)
|
|||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
static gboolean on_delete(GtkWidget* w, gpointer data)
|
||||
gboolean on_delete(GtkWidget* w, gpointer data)
|
||||
{
|
||||
/* Make sure to flush any modified dive data */
|
||||
update_dive(NULL);
|
||||
|
|
4
macos.c
4
macos.c
|
@ -79,8 +79,6 @@ int subsurface_fill_device_list(GtkListStore *store)
|
|||
GtkTreeIter iter;
|
||||
GDir *dev;
|
||||
const char *name;
|
||||
char *buffer;
|
||||
gsize length;
|
||||
|
||||
dev = g_dir_open("/dev", 0, NULL);
|
||||
while (dev && (name = g_dir_read_name(dev)) != NULL) {
|
||||
|
@ -206,7 +204,7 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|||
|
||||
gtk_osxapplication_set_use_quartz_accelerators(osx_app, TRUE);
|
||||
g_signal_connect(osx_app,"NSApplicationDidBecomeActive",G_CALLBACK(show_main_window),NULL);
|
||||
g_signal_connect(osx_app,"NSApplicationWillTerminate",G_CALLBACK(quit),NULL);
|
||||
g_signal_connect(osx_app, "NSApplicationBlockTermination", G_CALLBACK(on_delete), NULL);
|
||||
|
||||
gtk_osxapplication_ready(osx_app);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue