LCOV - code coverage report
Current view: top level - gui/source - gui_main.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.65.6_covts Lines: 0 27 0.0 %
Date: 2025-09-25 21:07:53 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* File: gui_main.c; Copyright and License: see below */
       2             : 
       3             : #include "gui_main.h"
       4             : #include "gui_main_window.h"
       5             : #include "gui_window_manager.h"
       6             : #include "storage/data_database_reader.h"
       7             : #include "meta/meta_info.h"
       8             : #include "u8/u8_trace.h"
       9             : #include "u8/u8_log.h"
      10             : #include "gui_gtk.h"
      11             : #include <stdio.h>
      12             : #include <stdlib.h>
      13             : 
      14             : static gui_window_manager_t window_manager;
      15             : 
      16           0 : static void gui_main_activate_callback( GtkApplication* app, gpointer user_data )
      17             : {
      18           0 :     U8_TRACE_BEGIN();
      19           0 :     U8_TRACE_TIMESTAMP();
      20           0 :     gui_window_manager_t *const win_manager = user_data;
      21           0 :     assert( win_manager != NULL );
      22             : 
      23           0 :     gui_window_manager_open_main_window( win_manager );
      24             : 
      25           0 :     U8_TRACE_END();
      26           0 : }
      27             : 
      28             : #if (( GTK_MAJOR_VERSION == 4 ) && ( GTK_MINOR_VERSION <= 6 ))
      29             : #define G_APPLICATION_DEFAULT_FLAGS (G_APPLICATION_FLAGS_NONE)
      30             : #endif  /* (( GTK_MAJOR_VERSION == 4 ) && ( GTK_MINOR_VERSION <= 6 )) */
      31             : 
      32           0 : void gui_main ( io_data_file_t *data_file, int argc, char **argv ) {
      33           0 :     U8_TRACE_BEGIN();
      34           0 :     U8_TRACE_TIMESTAMP();
      35           0 :     U8_TRACE_INFO_INT( "sizeof(gui_window_manager_t):", sizeof(gui_window_manager_t) );
      36             :     /* expect that no gtk_get_micro_version needed for analysis: */
      37           0 :     U8_LOG_EVENT_INT( "compiled against gtk:    ", GTK_MAJOR_VERSION * 1000 + GTK_MINOR_VERSION );
      38           0 :     U8_LOG_EVENT_INT( "linked against gtk:    ", gtk_get_major_version() * 1000 + gtk_get_minor_version() );
      39           0 :     U8_TRACE_INFO( "initializing gui thread..." );
      40             : 
      41             :     /* init */
      42             :     GtkApplication *const gtk_app
      43           0 :         = gtk_application_new( META_INFO_APPLICATION_ID_STR, G_APPLICATION_DEFAULT_FLAGS );
      44             : 
      45             :     /* get the icon */
      46             :     /*
      47             :     GtkIconTheme* icon_theme = gtk_icon_theme_get_for_display( gdk_display_get_default () );
      48             :     gtk_icon_theme_add_search_path( icon_theme, "/usr/share/pixmaps/" );
      49             :     if( gtk_icon_theme_has_icon( icon_theme, "crystal-facet-uml" ) != 1 )
      50             :     {
      51             :         U8_LOG_WARNING( "app icon not found" );
      52             :     }
      53             :     gtk_window_set_default_icon_name("crystal-facet-uml");
      54             :     */
      55             : 
      56           0 :     gui_window_manager_init( &window_manager, data_file, gtk_app );
      57             : 
      58           0 :     g_signal_connect( gtk_app, "activate", G_CALLBACK( gui_main_activate_callback ), &window_manager);
      59             : 
      60             :     /* run */
      61           0 :     U8_LOG_EVENT( "Connecting to a display (if display is remote, this may take some seconds) ..." );
      62           0 :     int error_code = g_application_run( G_APPLICATION(gtk_app), argc, argv );
      63           0 :     if ( error_code != 0 )
      64             :     {
      65           0 :         U8_LOG_ERROR_INT( "g_application_run:", error_code );
      66             :     }
      67             : 
      68             :     /* destroy */
      69           0 :     gui_window_manager_destroy( &window_manager );
      70             :     /* g_object_unref( icon_theme ); */
      71           0 :     g_object_unref( gtk_app );
      72             : 
      73           0 :     U8_TRACE_TIMESTAMP();
      74           0 :     U8_TRACE_END();
      75           0 : }
      76             : 
      77             : 
      78             : /*
      79             : Copyright 2016-2025 Andreas Warnke
      80             : 
      81             : Licensed under the Apache License, Version 2.0 (the "License");
      82             : you may not use this file except in compliance with the License.
      83             : You may obtain a copy of the License at
      84             : 
      85             :     http://www.apache.org/licenses/LICENSE-2.0
      86             : 
      87             : Unless required by applicable law or agreed to in writing, software
      88             : distributed under the License is distributed on an "AS IS" BASIS,
      89             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      90             : See the License for the specific language governing permissions and
      91             : limitations under the License.
      92             : */

Generated by: LCOV version 1.16