mirror of
https://github.com/alexkay/spek.git
synced 2025-04-16 16:42:19 +03:00
osx: Move the main menu to where it belongs
Also fix rigth click → Quit (issue 24) and the ⌘ Q shortcut (issue 44).
This commit is contained in:
parent
a058390b3f
commit
51c8b6fcc0
@ -34,7 +34,7 @@
|
||||
|
||||
void spek_platform_init () {
|
||||
#ifdef G_OS_DARWIN
|
||||
GtkOSXApplication *app = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -65,6 +65,20 @@ void spek_platform_fix_args (gchar **argv, gint argc) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void spek_platform_fix_ui (GtkUIManager *ui)
|
||||
{
|
||||
#ifdef G_OS_DARWIN
|
||||
GtkOSXApplication *app = NULL;
|
||||
GtkWidget *menubar = NULL;
|
||||
|
||||
app = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
menubar = gtk_ui_manager_get_widget (ui, "/MenuBar");
|
||||
gtk_widget_hide (menubar);
|
||||
gtk_osxapplication_set_menu_bar (app, GTK_MENU_SHELL (menubar));
|
||||
gtk_osxapplication_ready (app);
|
||||
#endif
|
||||
}
|
||||
|
||||
void spek_platform_show_uri (const gchar *uri) {
|
||||
#ifdef G_OS_WIN32
|
||||
/* gtk_show_uri doesn't work on Windows... */
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __SPEK_PLATFORM_H__
|
||||
#define __SPEK_PLATFORM_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Platform-specific initialisation */
|
||||
void spek_platform_init ();
|
||||
@ -27,6 +27,9 @@ void spek_platform_init ();
|
||||
/* Convert from UTF-16 to UTF-8 when running on Windows */
|
||||
void spek_platform_fix_args (gchar **argv, gint argc);
|
||||
|
||||
/* OSX has its own approach to menu bars */
|
||||
void spek_platform_fix_ui (GtkUIManager *ui);
|
||||
|
||||
/* Open a link in the browser */
|
||||
void spek_platform_show_uri (const gchar *uri);
|
||||
|
||||
|
@ -123,6 +123,8 @@ namespace Spek {
|
||||
toolbar.show_all ();
|
||||
spectrogram.show_all ();
|
||||
vbox.show ();
|
||||
|
||||
Platform.fix_ui (ui);
|
||||
show ();
|
||||
|
||||
// Set up Drag and Drop
|
||||
|
@ -2,6 +2,7 @@
|
||||
namespace Spek.Platform {
|
||||
public static void init ();
|
||||
public static void fix_args (string[] args);
|
||||
public static void fix_ui (Gtk.UIManager ui);
|
||||
public static void show_uri (string uri);
|
||||
public static string read_line (string uri);
|
||||
public static double get_font_scale ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user