summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-01-10 05:11:21 +0000
committerDavid Robillard <d@drobilla.net>2015-01-10 05:11:21 +0000
commit28903bcceaa43393492f5426dcd2ab079eeed3bd (patch)
treed855bab757940d479d0d9a808c925b76d35e8011 /src
parent87e705caa05527d031d6c3b8d38a2aeba8bf2977 (diff)
downloadpatchage-28903bcceaa43393492f5426dcd2ab079eeed3bd.tar.gz
patchage-28903bcceaa43393492f5426dcd2ab079eeed3bd.tar.bz2
patchage-28903bcceaa43393492f5426dcd2ab079eeed3bd.zip
OSX quit integration.
Save settings on exit. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5514 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Patchage.cpp25
-rw-r--r--src/Patchage.hpp1
2 files changed, 22 insertions, 4 deletions
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 1944ef3..250704a 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -61,6 +61,15 @@ can_activate_cb(GtkWidget* widget, guint signal_id, gpointer data)
{
return gtk_widget_is_sensitive(widget);
}
+
+static void
+terminate_cb(GtkosxApplication* app, gpointer data)
+{
+ Patchage* patchage = (Patchage*)data;
+ patchage->save();
+ Gtk::Main::quit();
+}
+
#endif
#ifdef HAVE_ALSA
@@ -304,21 +313,20 @@ Patchage::Patchage(int argc, char** argv)
GtkosxApplication* osxapp = (GtkosxApplication*)g_object_new(
GTKOSX_TYPE_APPLICATION, NULL);
_menubar->hide();
+ _menu_file_quit->hide();
gtkosx_application_set_menu_bar(osxapp, GTK_MENU_SHELL(_menubar->gobj()));
gtkosx_application_insert_app_menu_item(
osxapp, GTK_WIDGET(_menu_help_about->gobj()), 0);
g_signal_connect(_menubar->gobj(), "can-activate-accel",
G_CALLBACK(can_activate_cb), NULL);
+ g_signal_connect(osxapp, "NSApplicationWillTerminate",
+ G_CALLBACK(terminate_cb), this);
gtkosx_application_ready(osxapp);
#endif
}
Patchage::~Patchage()
{
- store_window_location();
- _conf->set_zoom(_canvas->get_zoom()); // Can be changed by ganv
- _conf->save();
-
#if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS)
delete _jack_driver;
#endif
@@ -856,8 +864,17 @@ Patchage::on_legend_color_change(int id, const std::string& label, uint32_t rgba
}
void
+Patchage::save()
+{
+ store_window_location();
+ _conf->set_zoom(_canvas->get_zoom()); // Can be changed by ganv
+ _conf->save();
+}
+
+void
Patchage::on_quit()
{
+ save();
#ifdef HAVE_ALSA
_alsa_driver->detach();
#endif
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index 7531fcb..2cc9347 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -76,6 +76,7 @@ public:
Glib::RefPtr<Gtk::Builder> xml() { return _xml; }
void attach();
+ void save();
void quit() { _main_win->hide(); }
void refresh();