Commit b6c6f0ef31df868cf2c30b2174b3bf5ff191011d
1 parent
d991edf9
Exists in
master
and in
5 other branches
Iniciando implementação do suporte a MACOS pelo gtk3
Showing
10 changed files
with
72 additions
and
11 deletions
Show diff stats
configure.ac
| ... | ... | @@ -314,6 +314,10 @@ AC_SUBST(LIBSSL_LIBS) |
| 314 | 314 | AC_SUBST(LIBSSL_CFLAGS) |
| 315 | 315 | |
| 316 | 316 | #--[ Libraries ]---------------------------------------------------------------------------------------------------------------------------------------------- |
| 317 | +PKG_CHECK_MODULES( [GTKMAC], [gtk-mac-integration], AC_DEFINE(HAVE_GTKMAC), AC_MSG_NOTICE([macosx integration not present.]) ) | |
| 318 | +AC_SUBST(GTKMAC_LIBS) | |
| 319 | +AC_SUBST(GTKMAC_CFLAGS) | |
| 320 | + | |
| 317 | 321 | AC_SEARCH_LIBS( [sin], [m], AC_DEFINE(HAVE_LIBM), AC_MSG_NOTICE([libm not present.])) |
| 318 | 322 | |
| 319 | 323 | AC_SUBST(SOCKET_LIBS) | ... | ... |
pw3270.xcodeproj/project.pbxproj
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXFileReference section */ |
| 10 | 10 | C21BB73815D940960093E2FA /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = "<group>"; }; |
| 11 | + C23EFD5315D99E2D00673C59 /* updateChangeLog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = updateChangeLog.sh; sourceTree = "<group>"; }; | |
| 11 | 12 | C272066315D7F88300CCCD22 /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = configure.ac; sourceTree = "<group>"; }; |
| 12 | 13 | C272066715D7FBF700CCCD22 /* action_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = action_table.h; sourceTree = "<group>"; }; |
| 13 | 14 | C272066815D7FBF700CCCD22 /* actions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = actions.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -263,6 +264,7 @@ |
| 263 | 264 | C232305B15D7F01F00E76E83 = { |
| 264 | 265 | isa = PBXGroup; |
| 265 | 266 | children = ( |
| 267 | + C23EFD5315D99E2D00673C59 /* updateChangeLog.sh */, | |
| 266 | 268 | C21BB73815D940960093E2FA /* Makefile.in */, |
| 267 | 269 | C2C4DAD815D8282600E8C6A0 /* autogen.sh */, |
| 268 | 270 | C272066315D7F88300CCCD22 /* configure.ac */, | ... | ... |
src/include/lib3270/config.h.in
src/pw3270/Makefile.in
| ... | ... | @@ -68,8 +68,8 @@ DEPENDS=*.h common/*.h uiparser/*.h v3270/*.h $(GLOBAL_DEPS) |
| 68 | 68 | |
| 69 | 69 | VALGRIND=@VALGRIND@ |
| 70 | 70 | |
| 71 | -CFLAGS=@CFLAGS@ @DLL_CFLAGS@ @GTK_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../../src/include | |
| 72 | -LIBS=@LIBS@ @GTK_LIBS@ | |
| 71 | +CFLAGS=@CFLAGS@ @DLL_CFLAGS@ @GTK_CFLAGS@ @GTKMAC_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../../src/include | |
| 72 | +LIBS=@LIBS@ @GTK_LIBS@ @GTKMAC_LIBS@ | |
| 73 | 73 | |
| 74 | 74 | #---[ Rules ]------------------------------------------------------------------ |
| 75 | 75 | ... | ... |
src/pw3270/main.c
| ... | ... | @@ -36,10 +36,18 @@ |
| 36 | 36 | #include "v3270/accessible.h" |
| 37 | 37 | #include <stdlib.h> |
| 38 | 38 | |
| 39 | +#ifdef HAVE_GTKMAC | |
| 40 | + #include <gtkmacintegration/gtkosxapplication.h> | |
| 41 | +#endif // HAVE_GTKMAC | |
| 42 | + | |
| 39 | 43 | /*--[ Statics ]--------------------------------------------------------------------------------------*/ |
| 40 | 44 | |
| 41 | 45 | static GtkWidget *toplevel = NULL; |
| 42 | 46 | |
| 47 | +#ifdef HAVE_GTKMAC | |
| 48 | + static GtkOSXApplication * osxapp = NULL; | |
| 49 | +#endif // HAVE_GTKMAC | |
| 50 | + | |
| 43 | 51 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 44 | 52 | |
| 45 | 53 | static int initialize(void) |
| ... | ... | @@ -116,6 +124,12 @@ int main(int argc, char *argv[]) |
| 116 | 124 | static const gchar * host = NULL; |
| 117 | 125 | int rc = 0; |
| 118 | 126 | |
| 127 | +#if ! GLIB_CHECK_VERSION(2,32,0) | |
| 128 | + g_thread_init(NULL); | |
| 129 | +#endif // !GLIB(2,32) | |
| 130 | + | |
| 131 | + gtk_init(&argc, &argv); | |
| 132 | + | |
| 119 | 133 | // Setup locale |
| 120 | 134 | #ifdef LC_ALL |
| 121 | 135 | setlocale( LC_ALL, "" ); |
| ... | ... | @@ -133,6 +147,21 @@ int main(int argc, char *argv[]) |
| 133 | 147 | g_free(appdir); |
| 134 | 148 | |
| 135 | 149 | } |
| 150 | +#elif defined(HAVE_GTKMAC) | |
| 151 | + { | |
| 152 | + osxapp = GTK_OSX_APPLICATION(g_object_new(GTK_TYPE_OSX_APPLICATION,NULL)); | |
| 153 | + | |
| 154 | + | |
| 155 | + gchar * appdir = g_build_filename(DATAROOTDIR,PACKAGE_NAME,NULL); | |
| 156 | + gchar * locdir = g_build_filename(DATAROOTDIR,"locale",NULL); | |
| 157 | + | |
| 158 | + g_chdir(appdir); | |
| 159 | + bindtextdomain( PACKAGE_NAME, locdir); | |
| 160 | + | |
| 161 | + g_free(locdir); | |
| 162 | + g_free(appdir); | |
| 163 | + | |
| 164 | + } | |
| 136 | 165 | #elif defined( DATAROOTDIR ) |
| 137 | 166 | { |
| 138 | 167 | gchar * appdir = g_build_filename(DATAROOTDIR,PACKAGE_NAME,NULL); |
| ... | ... | @@ -168,12 +197,6 @@ int main(int argc, char *argv[]) |
| 168 | 197 | |
| 169 | 198 | g_option_context_add_main_entries(options, app_options, NULL); |
| 170 | 199 | |
| 171 | -#if ! GLIB_CHECK_VERSION(2,32,0) | |
| 172 | - g_thread_init(NULL); | |
| 173 | -#endif // !GLIB(2,32) | |
| 174 | - | |
| 175 | - gtk_init(&argc, &argv); | |
| 176 | - | |
| 177 | 200 | if(!g_option_context_parse( options, &argc, &argv, &error )) |
| 178 | 201 | { |
| 179 | 202 | int f; |
| ... | ... | @@ -226,6 +249,10 @@ int main(int argc, char *argv[]) |
| 226 | 249 | if(pw3270_get_toggle(toplevel,LIB3270_TOGGLE_FULL_SCREEN)) |
| 227 | 250 | gtk_window_fullscreen(GTK_WINDOW(toplevel)); |
| 228 | 251 | |
| 252 | +#ifdef HAVE_GTKMAC | |
| 253 | + gtk_osxapplication_ready(osxapp); | |
| 254 | +#endif // HAVE_GTKMAC | |
| 255 | + | |
| 229 | 256 | gtk_main(); |
| 230 | 257 | |
| 231 | 258 | } | ... | ... |
src/pw3270/uiparser/menubar.c
| ... | ... | @@ -35,7 +35,9 @@ |
| 35 | 35 | |
| 36 | 36 | GObject * ui_create_menubar(GMarkupParseContext *context,GtkAction *action,struct parser *info,const gchar **names, const gchar **values, GError **error) |
| 37 | 37 | { |
| 38 | - if(info->element) | |
| 38 | + GtkWidget *menu; | |
| 39 | + | |
| 40 | + if(info->element) | |
| 39 | 41 | { |
| 40 | 42 | *error = g_error_new(ERROR_DOMAIN,EINVAL, _( "<%s> should be on toplevel"), "menubar"); |
| 41 | 43 | return NULL; |
| ... | ... | @@ -47,7 +49,12 @@ |
| 47 | 49 | return NULL; |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | - return ui_insert_element(info, action, UI_ELEMENT_MENUBAR, names, values, G_OBJECT(gtk_menu_bar_new()),error); | |
| 52 | + menu = gtk_menu_bar_new(); | |
| 53 | + | |
| 54 | + if(ui_get_bool_attribute("topmenu",names,values,info->topmenu == NULL)) | |
| 55 | + info->topmenu = menu; | |
| 56 | + | |
| 57 | + return ui_insert_element(info, action, UI_ELEMENT_MENUBAR, names, values, G_OBJECT(menu),error); | |
| 51 | 58 | } |
| 52 | 59 | |
| 53 | 60 | void ui_end_menubar(GMarkupParseContext *context,GObject *widget,struct parser *info,GError **error) | ... | ... |
src/pw3270/uiparser/menuitem.c
| ... | ... | @@ -31,6 +31,11 @@ |
| 31 | 31 | |
| 32 | 32 | #include "private.h" |
| 33 | 33 | |
| 34 | + #ifdef HAVE_GTKMAC | |
| 35 | + #include <gtkmacintegration/gtk-mac-menu.h> | |
| 36 | + #endif // HAVE_GTKMAC | |
| 37 | + | |
| 38 | + | |
| 34 | 39 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 35 | 40 | |
| 36 | 41 | GObject * ui_create_menuitem(GMarkupParseContext *context,GtkAction *action,struct parser *info,const gchar **names, const gchar **values, GError **error) | ... | ... |
src/pw3270/uiparser/parser.c
| ... | ... | @@ -31,6 +31,11 @@ |
| 31 | 31 | |
| 32 | 32 | #include "private.h" |
| 33 | 33 | |
| 34 | + #ifdef HAVE_GTKMAC | |
| 35 | + #include <gtkmacintegration/gtk-mac-menu.h> | |
| 36 | + #endif // HAVE_GTKMAC | |
| 37 | + | |
| 38 | + | |
| 34 | 39 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 35 | 40 | |
| 36 | 41 | void parser_init(struct parser *p) |
| ... | ... | @@ -216,6 +221,14 @@ void parser_build(struct parser *p, GtkWidget *widget) |
| 216 | 221 | gtk_window_add_accel_group(GTK_WINDOW(p->toplevel),a_info.accel_group); |
| 217 | 222 | |
| 218 | 223 | gtk_window_set_default(GTK_WINDOW(p->toplevel),widget); |
| 224 | + | |
| 225 | +#ifdef HAVE_GTKMAC | |
| 226 | + if(p->topmenu) | |
| 227 | + { | |
| 228 | + gtk_widget_set_visible(p->topmenu,FALSE); | |
| 229 | + gtk_mac_menu_set_menu_bar(GTK_MENU_SHELL(p->topmenu)); | |
| 230 | + } | |
| 231 | +#endif // HAVE_GTKMAC | |
| 219 | 232 | |
| 220 | 233 | } |
| 221 | 234 | ... | ... |
src/pw3270/uiparser/private.h
updateChangeLog.sh