summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@fedoraproject.org>2014-01-12 17:00:26 -0500
committerTingPing <tingping@tingping.se>2014-01-14 22:14:27 -0500
commit7b0acb2b4440e0254320ca4b18ed565fe73048cb (patch)
tree0b6ae4326803314bc7447df9e50f2741d510c226 /src
parent4319f8009c36fd1e6f68fb943f52d9e5e7dd93ed (diff)
Build with gtk-mac-integration
- Use HexChat logo for dock icon
- Use appmenu (not finished)
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c3
-rw-r--r--src/fe-gtk/fe-gtk.c15
-rw-r--r--src/fe-gtk/fe-gtk.h9
-rw-r--r--src/fe-gtk/maingui.c4
4 files changed, 31 insertions, 0 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 9f1db75f..489eeda2 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -765,6 +765,9 @@ load_default_config(void)
 	prefs.hex_gui_autoopen_dialog = 1;
 	prefs.hex_gui_autoopen_recv = 1;
 	prefs.hex_gui_autoopen_send = 1;
+#ifdef HAVE_GTK_MAC
+	prefs.hex_gui_hide_menu = 1;
+#endif
 	prefs.hex_gui_input_attr = 1;
 	prefs.hex_gui_input_icon = 1;
 	prefs.hex_gui_input_nick = 1;
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index f8954793..e930cb1f 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -63,6 +63,10 @@ GdkPixmap *channelwin_pix;
 static ca_context *ca_con;
 #endif
 
+#ifdef HAVE_GTK_MAC
+GtkosxApplication *osx_app;
+#endif
+
 /* === command-line parameter parsing : requires glib 2.6 === */
 
 static char *arg_cfgdir = NULL;
@@ -235,6 +239,10 @@ fe_args (int argc, char *argv[])
 
 	gtk_init (&argc, &argv);
 
+#ifdef HAVE_GTK_MAC
+	osx_app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
+#endif
+
 	return -1;
 }
 
@@ -285,6 +293,9 @@ fe_init (void)
 	key_init ();
 	pixmaps_init ();
 
+#ifdef HAVE_GTK_MAC
+	gtkosx_application_set_dock_icon_pixbuf (osx_app, pix_hexchat);
+#endif
 	channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
 	input_style = create_input_style (gtk_style_new ());
 }
@@ -292,6 +303,10 @@ fe_init (void)
 void
 fe_main (void)
 {
+#ifdef HAVE_GTK_MAC
+	gtkosx_application_ready(osx_app);
+#endif
+
 	gtk_main ();
 
 	/* sleep for 2 seconds so any QUIT messages are not lost. The  */
diff --git a/src/fe-gtk/fe-gtk.h b/src/fe-gtk/fe-gtk.h
index 623f2c01..ddb3324e 100644
--- a/src/fe-gtk/fe-gtk.h
+++ b/src/fe-gtk/fe-gtk.h
@@ -49,6 +49,11 @@
 #endif
 
 #include <gtk/gtk.h>
+
+#ifdef HAVE_GTK_MAC
+#include <gtkosxapplication.h>
+#endif
+
 #include "banlist.h"
 
 #undef gtk_signal_connect
@@ -65,6 +70,10 @@
 #define flag_b flag_wid[8]
 #define NUM_FLAG_WIDS 9
 
+#ifdef HAVE_GTK_MAC
+extern GtkosxApplication *osx_app;
+#endif
+
 struct server_gui
 {
 	GtkWidget *rawlog_window;
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 0186e944..c2308621 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -3099,6 +3099,10 @@ mg_create_menu (session_gui *gui, GtkWidget *table, int away_state)
 											gui->menu_item);
 	gtk_table_attach (GTK_TABLE (table), gui->menu, 0, 3, 0, 1,
 						   GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
+
+#ifdef HAVE_GTK_MAC
+	gtkosx_application_set_menu_bar(osx_app, GTK_MENU_SHELL(gui->menu));
+#endif
 }
 
 static void