static void load_icon(void) { GdkPixbuf *pix = NULL; gchar *filename; if(program_logo && !g_strcasecmp(program_logo,"none")) return; if(program_logo) filename = g_strdup(program_logo); else filename = g_build_filename(program_data,PROGRAM_LOGO,NULL); if(!g_file_test(filename,G_FILE_TEST_IS_REGULAR)) { g_free(filename); return; } pix = gdk_pixbuf_new_from_file(filename, NULL); if(pix) { static const size[] = { 16, 32, 48, 64, 128, 256 }; GList *icon = NULL; int f; gtk_window_set_default_icon(pix); g_object_set_data_full(G_OBJECT(topwindow),"logo",pix,g_object_unref); #if defined( HAVE_IGEMAC ) gtk_osxapplication_set_dock_icon_pixbuf(osxapp,pix); #endif for(f=0;f<G_N_ELEMENTS(size);f++) { pix = gdk_pixbuf_new_from_file_at_size(filename,size[f],size[f],NULL); if(pix) icon = g_list_append(icon, pix); } gtk_window_set_default_icon_list(icon); } g_free(filename); }
void main_mac_osx ( int argc, char **argv ) { #ifdef GTKOSXAPPLICATION GtkWidget *vbox; GtkWidget *menubar; GdkPixbuf *pixbuf; cmdline_options opt; gboolean first_use = FALSE; gint status = CMDLINE_SYNTAX_OK; GtkOSXApplication *theApp; devel_debug ("main_mac_osx"); #if IS_DEVELOPMENT_VERSION == 1 gsb_grisbi_print_environment_var ( ); #endif gtk_init ( &argc, &argv ); /* initialisation libgoffice */ libgoffice_init ( ); /* Initialize plugins manager */ go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE); /* init the app */ theApp = g_object_new ( GTK_TYPE_OSX_APPLICATION, NULL ); /* initialisation des différents répertoires */ gsb_dirs_init ( ); bindtextdomain ( PACKAGE, gsb_dirs_get_locale_dir ( ) ); bind_textdomain_codeset ( PACKAGE, "UTF-8" ); textdomain ( PACKAGE ); /* Setup locale/gettext */ setlocale (LC_ALL, ""); gsb_locale_init ( ); /* on commence par détourner le signal SIGSEGV */ gsb_grisbi_trappe_signal_sigsegv ( ); /* parse command line parameter, exit with correct error code when needed */ if ( !parse_options (argc, argv, &opt, &status ) ) exit ( status ); /* initialise les données de l'application */ first_use = gsb_grisbi_init_app ( ); vbox = gsb_main_create_main_window ( ); { gboolean falseval = FALSE; gboolean trueval = TRUE; g_signal_connect ( theApp, "NSApplicationDidBecomeActive", G_CALLBACK ( grisbi_osx_app_active_cb ), &trueval ); g_signal_connect ( theApp, "NSApplicationWillResignActive", G_CALLBACK ( grisbi_osx_app_active_cb ), &falseval); g_signal_connect ( theApp, "NSApplicationBlockTermination", G_CALLBACK ( gsb_main_grisbi_close ), NULL); g_signal_connect ( theApp, "NSApplicationWillTerminate", G_CALLBACK ( main_window_destroy_event ), NULL ); } menubar = gsb_grisbi_create_main_menu ( vbox ); grisbi_osx_init_menus ( main_window, menubar ); main_window_set_size_and_position ( ); gtk_widget_show ( run.window ); #if IS_DEVELOPMENT_VERSION == 1 dialog_message ( "development-version", VERSION ); #endif gsb_grisbi_load_file_if_necessary ( &opt ); if ( first_use && !nom_fichier_comptes ) gsb_assistant_first_run (); else display_tip ( FALSE ); if ( quartz_application_get_bundle_id ( ) == NULL ) { pixbuf = gdk_pixbuf_new_from_file ( g_build_filename (gsb_dirs_get_pixmaps_dir ( ), "grisbi-logo.png", NULL), NULL ); if ( pixbuf ) gtk_osxapplication_set_dock_icon_pixbuf ( theApp, pixbuf ); } gtk_osxapplication_set_use_quartz_accelerators ( theApp, TRUE ); gtk_osxapplication_ready ( theApp ); gtk_main (); /* sauvegarde les raccourcis claviers */ gtk_accel_map_save ( gsb_dirs_get_accelerator_filename () ); g_object_unref ( theApp ); gsb_locale_shutdown ( ); gsb_dirs_shutdown ( ); /* liberation libgoffice */ libgoffice_shutdown ( ); #if GSB_GMEMPROFILE g_mem_profile(); #endif exit ( 0 ); #endif /* GTKOSXAPPLICATION */ }