File indexing completed on 2024-05-05 05:34:56

0001 /*
0002     this file is part of the oxygen gtk engine
0003     SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0004 
0005     based on the Null Theme Engine for Gtk+.
0006     SPDX-FileCopyrightText: 2008 Robert Staudinger <robert.staudinger@gmail.com>
0007 
0008     SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #include "oxygenversion.h"
0012 #include "oxygendemodialog.h"
0013 
0014 //___________________________________________________________________
0015 int main( int argc, char** argv )
0016 {
0017 
0018     // initialize gtk
0019     gtk_init(&argc, &argv);
0020 
0021     // command line arguments
0022     gboolean version( FALSE );
0023     GOptionEntry entries[] =
0024     {
0025         { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show the application's version", 0L },
0026         { 0L }
0027     };
0028 
0029     GError *error = 0L;
0030     GOptionContext* context( g_option_context_new( "- Gtk+ widgets preview for oxygen" ) );
0031     g_option_context_add_main_entries(context, entries, 0L );
0032     g_option_context_add_group (context, gtk_get_option_group( TRUE ) );
0033     g_option_context_parse( context, &argc, &argv, &error );
0034     g_option_context_free( context );
0035 
0036     if( version )
0037     {
0038         /*
0039         HACK: need to create (and destroy immediatly) a dummy window
0040         in order to make sure that the widget style is initialized properly
0041         */
0042         GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
0043         gtk_widget_destroy( window );
0044 
0045         Oxygen::Version::print();
0046         return 0;
0047     }
0048 
0049     // dialog
0050     Oxygen::DemoDialog demoDialog;
0051 
0052     // connect demo dialog destruction to quit
0053     g_signal_connect( G_OBJECT( demoDialog.mainWidget() ), "destroy", G_CALLBACK(gtk_main_quit), 0L);
0054     gtk_widget_show( demoDialog.mainWidget() );
0055 
0056     // run main loop
0057     gtk_main();
0058 
0059     return 0;
0060 
0061 }