AM_VALAFLAGS = \
config.vapi \
+ --vapidir=$(top_srcdir)/vapi \
--pkg gio-2.0
libmoonshot_libmoonshot_la_CPPFLAGS = \
$(libmoonshot_CFLAGS) \
- $(AM_CPPFLAGS)
+ $(AM_CPPFLAGS)
libmoonshot_libmoonshot_la_SOURCES = libmoonshot/libmoonshot-common.c
src/moonshot-id.vala
src_moonshot_VALAFLAGS = --pkg gdk-2.0 --pkg gtk+-2.0 --pkg gee-1.0 $(AM_VALAFLAGS)
-src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
-src_moonshot_LDADD = $(moonshot_LIBS)
+src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
+src_moonshot_LDADD = $(moonshot_LIBS)
src_moonshot_webp_VALAFLAGS = --vapidir=$(top_srcdir)/libmoonshot --pkg gdk-2.0 --pkg libmoonshot $(AM_VALAFLAGS)
src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
if OS_MACOS
-AM_CPPFLAGS += -DOS_MACOS
-AM_VALAFLAGS += --define=OS_MACOS
+AM_CPPFLAGS += -DOS_MACOS $(MAC_CFLAGS)
+AM_VALAFLAGS += --define=OS_MACOS --pkg gtk-mac-integration
+moonshot_LIBS += $(MAC_LIBS)
endif
[SERVER_IPC_MODULE="gio-2.0"],
[SERVER_IPC_MODULE="dbus-glib-1"]
)
+
+ PKG_CHECK_MODULES([MAC],
+ [gtk-mac-integration >= 1.0.1]
+ )
# TODO: Move to GTK+-3
# [gtk+-3.0 >= 2.0],
$GTK_VERSION
gee-1.0 >= 0.5
$SERVER_IPC_MODULE
+ $MAC
])
PKG_CHECK_MODULES(libmoonshot,[
private const int WINDOW_WIDTH = 400;
private const int WINDOW_HEIGHT = 500;
protected IdentityManagerApp parent_app;
+#if OS_MACOS
+ public OSXApplication osxApp;
+#endif
private UIManager ui_manager = new UIManager();
private Entry search_entry;
private VBox vbox_right;
public IdentityManagerView(IdentityManagerApp app) {
parent_app = app;
- identities_manager = parent_app.model;
+#if OS_MACOS
+ osxApp = OSXApplication.get_instance();
+#endif
+ identities_manager = parent_app.model;
request_queue = new GLib.Queue<IdentityRequest>();
service_button_map = new HashTable<Gtk.Button, string> (direct_hash, direct_equal);
this.title = "Moonshoot";
this.set_position (WindowPosition.CENTER);
set_default_size (WINDOW_WIDTH, WINDOW_HEIGHT);
build_ui();
- setup_list_model();
+ setup_list_model();
load_id_cards();
+#if OS_MACOS
+ osxApp = app.osxApp;
+#endif
connect_signals();
}
var menubar = this.ui_manager.get_widget ("/MenuBar");
main_vbox.pack_start (menubar, false, false, 0);
main_vbox.pack_start (hbox, true, true, 0);
+#if OS_MACOS
+ var menushell = this.ui_manager.get_widget("/Menu") as Gtk.MenuShell;
+ osxApp.set_menu_bar(menushell);
+#endif
add (main_vbox);
main_vbox.show_all();
using Gtk;
+
class IdentityManagerApp : Window {
public IdentityManagerModel model;
private IdentityManagerView view;
private MoonshotServer ipc_server;
+#if OS_MACOS
+ public OSXApplication osxApp;
+#endif
private const int WINDOW_WIDTH = 400;
private const int WINDOW_HEIGHT = 500;
public void show() {
model = new IdentityManagerModel(this);
view = new IdentityManagerView(this);
init_ipc_server ();
+#if OS_MACOS
+ osxApp = OSXApplication.get_instance();
+#endif
view.show();
}
public static int main(string[] args){
Gtk.init(ref args);
+ stdout.printf("Hello\n");
+ foreach (string arg in args)
+ stdout.printf("arg %s\n", arg);
#if OS_WIN32
// Force specific theme settings on Windows without requiring a gtkrc file
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
Intl.textdomain (Config.GETTEXT_PACKAGE);
+
var app = new IdentityManagerApp();
app.show();
--- /dev/null
+[CCode(cheader_filename="gtkosxapplication.h")]
+public class Gtk.OSXApplication : GLib.Object {
+ [CCode(cname="GTK_TYPE_OSX_APPLICATION")]
+ public static GLib.Type GTK_TYPE_OSX_APPLICATION;
+
+ public static OSXApplication get_instance() {
+ return (Gtk.OSXApplication) GLib.Object.new(GTK_TYPE_OSX_APPLICATION);
+ }
+ [CCode(cname="gtk_osxapplication_set_menu_bar")]
+ public void set_menu_bar(Gtk.MenuShell shell);
+
+ [CCode(cname="gtk_osxapplication_ready")]
+ public void ready();
+
+ [CCode(cname="gtk_osxapplication_sync_menubar")]
+ public void sync_menu_bar();
+}