/[svn]/gigedit/trunk/src/gigedit/main.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1398 by schoenebeck, Wed Oct 10 22:41:51 2007 UTC revision 3202 by persson, Mon May 22 18:58:46 2017 UTC
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20    #include "global.h"
21    #include <gtk/gtk.h>
22  #include "gigedit.h"  #include "gigedit.h"
23    #include <gtkmm.h>
24    
25    #if GTKMM_MAJOR_VERSION >= 3
26    
27    /**
28     * This is required since GTK 3, because those GTK super heros came up with
29     * the clever idea to simply disable things like icons and keyboard shortcuts
30     * for menus and for buttons by default for all users, all devices and all
31     * apps. Yey! Seriously, I have no idea what came on their mind to find that
32     * was a good idea!
33     */
34    static void enforceGtk3Settings(int argc, char* argv[]) {
35        gtk_init(&argc, &argv);
36    
37        // got not behavior change on those 2 settings, so ignoring them for now,
38        // actually I though I could use them to show the mnemonics in the GTK 3
39        // menus again, but it seems that was entirely removed from around GTK 3.10.
40        //g_object_set(gtk_settings_get_default(), "gtk-auto-mnemonics", false, NULL);
41        //g_object_set(gtk_settings_get_default(), "gtk-can-change-accels", true, NULL);
42    
43        // bring back keyboard accelerators with GTK 3
44        g_object_set(gtk_settings_get_default(), "gtk-enable-accels", true, NULL);
45        g_object_set(gtk_settings_get_default(), "gtk-enable-mnemonics", true, NULL);
46    
47        // bring back icons with GTK 3
48        g_object_set(gtk_settings_get_default(), "gtk-menu-images", true, NULL);
49        g_object_set(gtk_settings_get_default(), "gtk-button-images", true, NULL);
50    
51        // who knows ... one day those GTK "masterminds" decide to disable tooltips by default as well
52        g_object_set(gtk_settings_get_default(), "gtk-enable-tooltips", true, NULL);
53    }
54    
55    #endif // GTKM 3
56    
57  #if defined(WIN32)  #if defined(WIN32)
58  #include <windows.h>  #include <windows.h>
# Line 25  Line 60 
60  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
61      LPSTR lpCmdLine, int nCmdShow)      LPSTR lpCmdLine, int nCmdShow)
62  {  {
63        #if GTKMM_MAJOR_VERSION >= 3
64        enforceGtk3Settings(__argc, __argv);
65        #endif
66    
67      GigEdit app;      GigEdit app;
68      return app.run();      return app.run(__argc, __argv);
69  }  }
70    
71  #else  #else
72    
73  int main(int argc, char* argv[])  int main(int argc, char* argv[])
74  {  {
75        #if GTKMM_MAJOR_VERSION >= 3
76        enforceGtk3Settings(argc, argv);
77        #endif
78    
79    #ifdef __APPLE__
80        // remove the argument added by the OS
81        if (argc > 1 && strncmp(argv[1], "-psn", 4) == 0) {
82            argc--;
83            for (int i = 1 ; i < argc ; i++) {
84                argv[i] = argv[i + 1];
85            }
86        }
87    #endif
88      GigEdit app;      GigEdit app;
89      return (argc >= 2) ? app.run(argv[1])      return app.run(argc, argv);
                        : app.run();  
90  }  }
91    
92  #endif  #endif

Legend:
Removed from v.1398  
changed lines
  Added in v.3202

  ViewVC Help
Powered by ViewVC